Skip to content

Commit 5a62b53

Browse files
committed
Merge branch 'jc/merge-ff-only-stronger-than-signed-merge' into maint
* jc/merge-ff-only-stronger-than-signed-merge: merge: do not create a signed tag merge under --ff-only option
2 parents 8eb865b + b5c9f1c commit 5a62b53

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

builtin/merge.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1283,7 +1283,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
12831283
sha1_to_hex(commit->object.sha1));
12841284
setenv(buf.buf, argv[i], 1);
12851285
strbuf_reset(&buf);
1286-
if (merge_remote_util(commit) &&
1286+
if (!fast_forward_only &&
1287+
merge_remote_util(commit) &&
12871288
merge_remote_util(commit)->obj &&
12881289
merge_remote_util(commit)->obj->type == OBJ_TAG) {
12891290
option_edit = 1;

t/t7600-merge.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Testing basic merge operations/option parsing.
2727
'
2828

2929
. ./test-lib.sh
30+
. "$TEST_DIRECTORY"/lib-gpg.sh
3031

3132
printf '%s\n' 1 2 3 4 5 6 7 8 9 >file
3233
printf '%s\n' '1 X' 2 3 4 5 6 7 8 9 >file.1
@@ -670,4 +671,16 @@ test_expect_success 'merge --no-ff --edit' '
670671
test_cmp actual expected
671672
'
672673

674+
test_expect_success GPG 'merge --ff-only tag' '
675+
git reset --hard c0 &&
676+
git commit --allow-empty -m "A newer commit" &&
677+
git tag -s -m "A newer commit" signed &&
678+
git reset --hard c0 &&
679+
680+
git merge --ff-only signed &&
681+
git rev-parse signed^0 >expect &&
682+
git rev-parse HEAD >actual &&
683+
test_cmp actual expect
684+
'
685+
673686
test_done

0 commit comments

Comments
 (0)