git merge <tag> behavior
- From
Yann Droneaud <ydroneaud@opteya.com>
- Date
- Mar 19, 2013, 14:55 UTC
- Message-ID
- <1363704914.6289.39.camel@test.quest-ce.net>
Hi,
While trying to reproduce/understand the problems[1][2] I was facing when using Google's Git repo tool[3], I've found minor problems in Git:
1) there's no mention of the git merge <tag> behavior in git-merge.1
When asking Git to merge a tag (such as a signed tag or annotated tag), it will always create a merge commit even if fast-forward was possible. It's like having --no-ff present on the command line.
It's a difference from the default behavior described in git-merge.1[4]. It should be documented as an exception of "FAST-FORWARD MERGE" section and "--ff" option description.
2) git merge <tag> VS git merge <object-id>
If <tag> is an object (not a lightweight/reference tag), git merge <tag> will by default create a merge commit with the tag message. Additionally, the signature check will be reported as comment, for example:
Merge tag 'v1.12.2' into branch-v1.12.2
repo 1.12.2
# gpg: Signature made Fri Mar 1 18:36:42 2013 CET using DSA key ID 920F5C65
# gpg: Good signature from "Repo Maintainer <repo@android.kernel.org>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg: There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 8BB9 AD79 3E8E 6153 AF0F 9A44 1653 0D5E 920F 5C65But, if you use the tag object-id instead of its name, for example using git merge `git show-ref <tag>`, the tag is not recognized and the signature is not checked. Git still create a merge commit, but doesn't prepare a commit message with the tag message and the signature:
Merge commit 'ac22c7ae2e652f63366b65ee23122292d3564fff' into branch-ac22c7ae2e652f63366b65ee23122292d3564fff
It would be great to have Git using the tag message and check the signature.
3) Merge options can't be overridden.
If I modify .git/config to set a merge option, for example forcing fast-forward merge, this option cannot be overridden on command line:
Example 1:
$ cat .git/config:
[branch "master"]
mergeoptions = --ff-only $ git merge --no-ff <tag>
fatal: You cannot combine --no-ff with --ff-onlyExample 2:
$ cat .git/config:
[merge]
ff = only $ git merge --no-ff <tag>
fatal: You cannot combine --no-ff with --ff-onlySetting the merge options in config should overridden by command line.
Regards.
[1] issue 135: repo: repo sync should force fast-forward merge https://code.google.com/p/git-repo/issues/detail?id=135
[2] Issue 136: repo: repo sync should use the tag name instead of object identifier of the tag https://code.google.com/p/git-repo/issues/detail?id=136
[3] git-repo - repo - The multiple repository tool http://code.google.com/p/git-repo/
[4] git-merge(1) Manual Page https://www.kernel.org/pub/software/scm/git/docs/git-merge.html
-- Yann Droneaud OPTEYA