Merge branch 'ps/reflog-migration-with-logall-fix'

The "git refs migrate" command did not migrate the reflog for
refs/stash, which is the contents of the stashes, which has been
corrected.

* ps/reflog-migration-with-logall-fix:
  refs: fix migration of reflogs respecting "core.logAllRefUpdates"
This commit is contained in:
Junio C Hamano
2025-01-29 14:05:10 -08:00
2 changed files with 18 additions and 1 deletions

2
refs.c
View File

@@ -1330,7 +1330,7 @@ int ref_transaction_update_reflog(struct ref_transaction *transaction,
assert(err);
flags |= REF_LOG_ONLY | REF_NO_DEREF;
flags |= REF_LOG_ONLY | REF_FORCE_CREATE_REFLOG | REF_NO_DEREF;
if (!transaction_refname_valid(refname, new_oid, flags, err))
return -1;

View File

@@ -224,6 +224,23 @@ do
test_commit --date "100003000 +0700" --no-tag -C repo second &&
test_migration repo "$to_format"
'
test_expect_success "$from_format -> $to_format: stash is retained" '
test_when_finished "rm -rf repo" &&
git init --ref-format=$from_format repo &&
(
cd repo &&
test_commit initial A &&
echo foo >A &&
git stash push &&
echo bar >A &&
git stash push &&
git stash list >expect.reflog &&
test_migration . "$to_format" &&
git stash list >actual.reflog &&
test_cmp expect.reflog actual.reflog
)
'
done
done