summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-03-08 16:46:33 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2015-03-08 16:50:27 +0100
commitd578b45f3fc8a95a279aa7dcf1a3585d5d7c1eab (patch)
tree240383fae22414a949c8de3f13bc02a65f2da5be /src
parent01c3b184d38e6a89a3dedeec735078d7bc6eaa5f (diff)
downloadlibgit2-d578b45f3fc8a95a279aa7dcf1a3585d5d7c1eab.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 'src')
-rw-r--r--src/refdb_fs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/refdb_fs.c b/src/refdb_fs.c
index 77cb1a8ce..e1a77f3ff 100644
--- a/src/refdb_fs.c
+++ b/src/refdb_fs.c
@@ -1324,7 +1324,7 @@ static int refdb_fs_backend__rename(
/* Try to rename the refog; it's ok if the old doesn't exist */
error = refdb_reflog_fs__rename(_backend, old_name, new_name);
if (((error == 0) || (error == GIT_ENOTFOUND)) &&
- ((error = reflog_append(backend, new, NULL, NULL, who, message)) < 0)) {
+ ((error = reflog_append(backend, new, git_reference_target(new), NULL, who, message)) < 0)) {
git_reference_free(new);
git_filebuf_cleanup(&file);
return error;