aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-01-29 14:05:09 -0800
committerJunio C Hamano <gitster@pobox.com>2025-01-29 14:05:10 -0800
commitd205f06ae07928b0c8b74930d76927a7e9b04781 (patch)
treef6b40c4430ce6eed311cfab315584af46c3d9dc2
parent8d6240d4c68e2d2aa372a116bdab8bcf3ff6d66b (diff)
parent3519492430ba26cadcdb215730a6c8e1bcf5b9cf (diff)
downloadgit-d205f06ae07928b0c8b74930d76927a7e9b04781.tar.xz
Merge branch 'kn/reflog-symref-fix'
reflog entries for symbolic ref updates were broken, which has been corrected. * kn/reflog-symref-fix: refs: fix creation of reflog entries for symrefs
-rw-r--r--refs/files-backend.c3
-rwxr-xr-xt/t1400-update-ref.sh9
2 files changed, 9 insertions, 3 deletions
diff --git a/refs/files-backend.c b/refs/files-backend.c
index 5cfb8b7ca8..29f08dced4 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -2615,9 +2615,6 @@ static int lock_ref_for_update(struct files_ref_store *refs,
update->backend_data = lock;
- if (update->flags & REF_LOG_ONLY)
- goto out;
-
if (update->type & REF_ISSYMREF) {
if (update->flags & REF_NO_DEREF) {
/*
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index e2316f1dd4..29045aad43 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -2068,4 +2068,13 @@ do
done
+test_expect_success 'update-ref should also create reflog for HEAD' '
+ test_commit to-rewind &&
+ git rev-parse HEAD >expect &&
+ head=$(git symbolic-ref HEAD) &&
+ git update-ref --create-reflog "$head" HEAD~ &&
+ git rev-parse HEAD@{1} >actual &&
+ test_cmp expect actual
+'
+
test_done