Skip to content

Commit

Permalink
Merge branch 'jc/merge-ff-only-stronger-than-signed-merge'
Browse files Browse the repository at this point in the history
* jc/merge-ff-only-stronger-than-signed-merge:
  merge: do not create a signed tag merge under --ff-only option
  • Loading branch information
gitster committed Feb 10, 2012
2 parents d88698e + b5c9f1c commit fd6abd0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion builtin/merge.c
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
sha1_to_hex(commit->object.sha1));
setenv(buf.buf, argv[i], 1);
strbuf_reset(&buf);
if (merge_remote_util(commit) &&
if (!fast_forward_only &&
merge_remote_util(commit) &&
merge_remote_util(commit)->obj &&
merge_remote_util(commit)->obj->type == OBJ_TAG) {
option_edit = 1;
Expand Down
13 changes: 13 additions & 0 deletions t/t7600-merge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Testing basic merge operations/option parsing.
'

. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-gpg.sh

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

test_expect_success GPG 'merge --ff-only tag' '
git reset --hard c0 &&
git commit --allow-empty -m "A newer commit" &&
git tag -s -m "A newer commit" signed &&
git reset --hard c0 &&
git merge --ff-only signed &&
git rev-parse signed^0 >expect &&
git rev-parse HEAD >actual &&
test_cmp actual expect
'

test_done

0 comments on commit fd6abd0

Please sign in to comment.