summaryrefslogtreecommitdiff
path: root/tests-clar/reset/hard.c
diff options
context:
space:
mode:
authorBen Straub <bs@github.com>2012-10-15 12:02:20 -0700
committerBen Straub <bs@github.com>2012-10-15 12:02:20 -0700
commit1c3acf148b97c952fcb942a73cda9f891f04f1b5 (patch)
tree8c8acd9fa3a5de6ecc051014ecb7c2dc81b7b04a /tests-clar/reset/hard.c
parent1ddc537c779a5796c4ed1d5fc2e41bd38cdeb394 (diff)
parent68206c54bf98f36725d21e7f7efee9f3af68d259 (diff)
downloadlibgit2-1c3acf148b97c952fcb942a73cda9f891f04f1b5.tar.gz
Merge pull request #978 from nulltoken/fix/reset-hard
reset: prevent hard reset in a bare repository
Diffstat (limited to 'tests-clar/reset/hard.c')
-rw-r--r--tests-clar/reset/hard.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests-clar/reset/hard.c b/tests-clar/reset/hard.c
index ad3badb8a..fdab9c536 100644
--- a/tests-clar/reset/hard.c
+++ b/tests-clar/reset/hard.c
@@ -44,3 +44,17 @@ void test_reset_hard__resetting_culls_empty_directories(void)
git_buf_free(&subfile_path);
git_buf_free(&newdir_path);
}
+
+void test_reset_hard__cannot_reset_in_a_bare_repository(void)
+{
+ git_repository *bare;
+
+ cl_git_pass(git_repository_open(&bare, cl_fixture("testrepo.git")));
+ cl_assert(git_repository_is_bare(bare) == true);
+
+ retrieve_target_from_oid(&target, bare, KNOWN_COMMIT_IN_BARE_REPO);
+
+ cl_assert_equal_i(GIT_EBAREREPO, git_reset(bare, target, GIT_RESET_HARD));
+
+ git_repository_free(bare);
+}