Skip to content

Commit 079036d

Browse files
committed
Merge branch 'ps/reflog-migration-with-logall-fix' into next
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"
2 parents 7dc4bda + a0bea09 commit 079036d

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

refs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1330,7 +1330,7 @@ int ref_transaction_update_reflog(struct ref_transaction *transaction,
13301330

13311331
assert(err);
13321332

1333-
flags |= REF_LOG_ONLY | REF_NO_DEREF;
1333+
flags |= REF_LOG_ONLY | REF_FORCE_CREATE_REFLOG | REF_NO_DEREF;
13341334

13351335
if (!transaction_refname_valid(refname, new_oid, flags, err))
13361336
return -1;

t/t1460-refs-migrate.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,23 @@ do
224224
test_commit --date "100003000 +0700" --no-tag -C repo second &&
225225
test_migration repo "$to_format"
226226
'
227+
228+
test_expect_success "$from_format -> $to_format: stash is retained" '
229+
test_when_finished "rm -rf repo" &&
230+
git init --ref-format=$from_format repo &&
231+
(
232+
cd repo &&
233+
test_commit initial A &&
234+
echo foo >A &&
235+
git stash push &&
236+
echo bar >A &&
237+
git stash push &&
238+
git stash list >expect.reflog &&
239+
test_migration . "$to_format" &&
240+
git stash list >actual.reflog &&
241+
test_cmp expect.reflog actual.reflog
242+
)
243+
'
227244
done
228245
done
229246

0 commit comments

Comments
 (0)