aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--refs.c2
-rwxr-xr-xt/t1460-refs-migrate.sh17
2 files changed, 18 insertions, 1 deletions
diff --git a/refs.c b/refs.c
index c555839869..c36bc57a6c 100644
--- a/refs.c
+++ b/refs.c
@@ -1282,7 +1282,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;
diff --git a/t/t1460-refs-migrate.sh b/t/t1460-refs-migrate.sh
index f59bc4860f..ceb0c4977d 100755
--- a/t/t1460-refs-migrate.sh
+++ b/t/t1460-refs-migrate.sh
@@ -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