Commit b52b6571afc96006de69aac77c8a9f97b3ebb9d3

nulltoken 2012-09-22T12:42:16

branch: enhance branch moving test coverage

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/tests-clar/refs/branches/move.c b/tests-clar/refs/branches/move.c
index 6750473..9ab7da4 100644
--- a/tests-clar/refs/branches/move.c
+++ b/tests-clar/refs/branches/move.c
@@ -62,3 +62,16 @@ void test_refs_branches_move__can_force_move_over_an_existing_branch(void)
 {
 	cl_git_pass(git_branch_move(ref, "master", 1));
 }
+
+void test_refs_branches_move__moving_the_branch_pointed_at_by_HEAD_updates_HEAD(void)
+{
+	git_reference *branch;
+
+	cl_git_pass(git_reference_lookup(&branch, repo, "refs/heads/master"));
+	cl_git_pass(git_branch_move(branch, "master2", 0));
+	git_reference_free(branch);
+
+	cl_git_pass(git_repository_head(&branch, repo));
+	cl_assert_equal_s("refs/heads/master2", git_reference_name(branch));
+	git_reference_free(branch);
+}