diff options
author | Patrick Steinhardt <ps@pks.im> | 2020-07-12 18:19:21 +0200 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2020-07-12 18:19:21 +0200 |
commit | ce4cb0738218ae6f5f52e1dce2a810feb34cfc4e (patch) | |
tree | dc21699d66a66fdb1bb6fd135a25b7618986349f | |
parent | 5434f9a363cd9eee1866033da23c9bc7446232b1 (diff) | |
download | libgit2-ce4cb0738218ae6f5f52e1dce2a810feb34cfc4e.tar.gz |
tests: verify renaming branch really updates worktree HEAD
In case where a branch is getting renamed, all HEADs of the main
repository and of its worktrees that point to the old branch need to get
updated to point to the new branch. We already do so and have a test for
this, but the test only verifies that we're able to lookup the updated
HEAD, not what it contains.
Let's make the test more specific by verifying the updated HEAD also has
the correct updated symbolic target.
-rw-r--r-- | tests/worktree/refs.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/worktree/refs.c b/tests/worktree/refs.c index 501255274..27dc667ea 100644 --- a/tests/worktree/refs.c +++ b/tests/worktree/refs.c @@ -163,7 +163,10 @@ void test_worktree_refs__renaming_reference_updates_worktree_heads(void) cl_git_pass(git_branch_lookup(&branch, fixture.repo, "testrepo-worktree", GIT_BRANCH_LOCAL)); cl_git_pass(git_reference_rename(&renamed, branch, "refs/heads/renamed", 0, NULL)); - cl_git_pass(git_repository_head(&head, fixture.worktree)); + + cl_git_pass(git_reference_lookup(&head, fixture.worktree, GIT_HEAD_FILE)); + cl_assert_equal_i(git_reference_type(head), GIT_REFERENCE_SYMBOLIC); + cl_assert_equal_s(git_reference_symbolic_target(head), "refs/heads/renamed"); git_reference_free(head); git_reference_free(branch); |