Commit ee8e6afda9b33a1e20b7db67136cfb9cad9d7846

Ben Straub 2014-02-01T11:46:44

Reflog: correct "new" id for reattaching HEAD

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/src/refdb_fs.c b/src/refdb_fs.c
index 41ff019..829e7c5 100644
--- a/src/refdb_fs.c
+++ b/src/refdb_fs.c
@@ -1452,7 +1452,9 @@ 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)
+		git_reference_name_to_id(&new_id, repo, git_reference_symbolic_target(ref));
+	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)