summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVicent Marti <vicent@github.com>2014-02-03 10:36:04 -0800
committerVicent Marti <vicent@github.com>2014-02-03 10:36:04 -0800
commit3b6a5bac20a9cb46cd29d74baf06cf8a8d1248fb (patch)
tree86409792a242e6bc776321e135bcdec7ceaf73bf /src
parent0b4d86af902916b5f98bdf92bc853e3e45edbf84 (diff)
parent7f058b86682e2a1566b192dfd1f0d333cc5b8c7c (diff)
downloadlibgit2-3b6a5bac20a9cb46cd29d74baf06cf8a8d1248fb.tar.gz
Merge pull request #2095 from libgit2/update-head-reflog
Correct "new" id for reattached-HEAD reflog entry
Diffstat (limited to 'src')
-rw-r--r--src/refdb_fs.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/refdb_fs.c b/src/refdb_fs.c
index 41ff01998..89c77c14c 100644
--- a/src/refdb_fs.c
+++ b/src/refdb_fs.c
@@ -1452,7 +1452,13 @@ static int reflog_append(refdb_fs_backend *backend, const git_reference *ref, co
if (error < 0)
return error;
- if (git_reference_target(ref) != NULL)
+ if (git_reference_symbolic_target(ref) != NULL) {
+ error = git_reference_name_to_id(&new_id, repo, git_reference_symbolic_target(ref));
+ if (error != 0 && error != GIT_ENOTFOUND)
+ goto cleanup;
+ giterr_clear();
+ }
+ else if (git_reference_target(ref) != NULL)
git_oid_cpy(&new_id, git_reference_target(ref));
if ((error = serialize_reflog_entry(&buf, &old_id, &new_id, who, message)) < 0)