Skip to content

Commit

Permalink
Merge branch 'ps/reflog-migration-with-logall-fix' into next
Browse files Browse the repository at this point in the history
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"
  • Loading branch information
gitster committed Jan 23, 2025
2 parents 7dc4bda + a0bea09 commit 079036d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion refs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
17 changes: 17 additions & 0 deletions t/t1460-refs-migrate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 079036d

Please sign in to comment.