diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2015-03-08 16:46:33 +0100 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2015-03-08 16:50:27 +0100 |
commit | d578b45f3fc8a95a279aa7dcf1a3585d5d7c1eab (patch) | |
tree | 240383fae22414a949c8de3f13bc02a65f2da5be /tests/refs/branches/move.c | |
parent | 01c3b184d38e6a89a3dedeec735078d7bc6eaa5f (diff) | |
download | libgit2-cmn/rename-reflog.tar.gz |
refdb: use the same id for old and new when renaming a referencecmn/rename-reflog
When we rename a reference, we want the old and new ids to be the same
one (as we did not change it). The normal code path looks up the old id
from the current value of the brtanch, but by the time we look it up, it
does not exist anymore and thus we write a zero id.
Pass the old id explicitly instead.
Diffstat (limited to 'tests/refs/branches/move.c')
-rw-r--r-- | tests/refs/branches/move.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/refs/branches/move.c b/tests/refs/branches/move.c index fa0b2faca..bec39e18b 100644 --- a/tests/refs/branches/move.c +++ b/tests/refs/branches/move.c @@ -203,6 +203,7 @@ void test_refs_branches_move__default_reflog_message(void) const git_reflog_entry *entry; git_signature *sig; git_config *cfg; + git_oid id; cl_git_pass(git_repository_config(&cfg, repo)); cl_git_pass(git_config_set_string(cfg, "user.name", "Foo Bar")); @@ -212,6 +213,7 @@ void test_refs_branches_move__default_reflog_message(void) cl_git_pass(git_signature_default(&sig, repo)); cl_git_pass(git_reference_lookup(&branch, repo, "refs/heads/master")); + git_oid_cpy(&id, git_reference_target(branch)); cl_git_pass(git_branch_move(&new_branch, branch, "master2", 0)); cl_git_pass(git_reflog_read(&log, repo, git_reference_name(new_branch))); @@ -219,6 +221,8 @@ void test_refs_branches_move__default_reflog_message(void) cl_assert_equal_s("branch: renamed refs/heads/master to refs/heads/master2", git_reflog_entry_message(entry)); cl_assert_equal_s(sig->email, git_reflog_entry_committer(entry)->email); + cl_assert_equal_oid(&id, git_reflog_entry_id_old(entry)); + cl_assert_equal_oid(&id, git_reflog_entry_id_new(entry)); git_reference_free(branch); git_reference_free(new_branch); |