git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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 5C65

But, 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-only
Example 2:
    $ cat .git/config:
    [merge]
           ff = only
    $ git merge --no-ff <tag>
    fatal: You cannot combine --no-ff with --ff-only
Setting 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
Next: Junio C Hamano
Message 1 of 53 in “git merge <tag> behavior”
  1. Yann DroneaudMar 19, 2013
  2. Junio C HamanoMar 19, 2013
  3. Re* git merge <tag> behaviorJunio C Hamano, Mar 19, 2013
  4. 0/3 Merging an annotated tag objectJunio C Hamano, Apr 1, 2013
  5. 1/3 merge: a random object may not necssarily be a commitJunio C Hamano, Apr 1, 2013
  6. Yann DroneaudApr 1, 2013
  7. Jeff KingApr 2, 2013
  8. Junio C HamanoApr 2, 2013
  9. Jeff KingApr 2, 2013
  10. 2/3 t6200: use test_config/test_unconfigJunio C Hamano, Apr 1, 2013
  11. 3/3 t6200: test message for merging of an annotated tagJunio C Hamano, Apr 1, 2013
  12. Documentation: merging a tag is a special caseYann Droneaud, Mar 20, 2013
  13. Jonathan NiederMar 20, 2013
  14. Junio C HamanoMar 20, 2013
  15. Junio C HamanoMar 21, 2013
  16. Jonathan NiederMar 21, 2013
  17. Junio C HamanoMar 21, 2013
  18. Jonathan NiederMar 21, 2013
  19. Yann DroneaudMar 21, 2013
  20. Documentation: merging a tag is a special caseYann Droneaud, Mar 21, 2013
  21. Jonathan NiederMar 21, 2013
  22. Yann DroneaudMar 20, 2013
  23. Yann DroneaudMar 20, 2013
  24. Junio C HamanoMar 20, 2013
  25. Max NanasyMar 21, 2013
  26. Yann DroneaudMar 22, 2013
  27. t7600: test merge configuration overrideYann Droneaud, Mar 22, 2013
  28. Junio C HamanoMar 22, 2013
  29. 00/15 Use test_configYann Droneaud, Mar 24, 2013
  30. 01/15 t4018: remove test_config implementationYann Droneaud, Mar 24, 2013
  31. 02/15 t7810: remove test_config implementationYann Droneaud, Mar 24, 2013
  32. 03/15 t7811: remove test_config implementationYann Droneaud, Mar 24, 2013
  33. 04/15 t3400: use test_config to set/unset git config variablesYann Droneaud, Mar 24, 2013
  34. 05/15 t4304: use test_config to set/unset git config variablesYann Droneaud, Mar 24, 2013
  35. 06/15 t4034: use test_config/test_unconfig to set/unset git config variablesYann Droneaud, Mar 24, 2013
  36. 07/15 t4202: use test_config/test_unconfig to set/unset git config variablesYann Droneaud, Mar 24, 2013
  37. 08/15 t5520: use test_config to set/unset git config variablesYann Droneaud, Mar 24, 2013
  38. 09/15 t5541: use test_config to set/unset git config variablesYann Droneaud, Mar 24, 2013
  39. 10/15 t7500: use test_config to set/unset git config variablesYann Droneaud, Mar 24, 2013
  40. 11/15 t7502: use test_config to set/unset git config variablesYann Droneaud, Mar 24, 2013
  41. 12/15 t7508: use test_config to set/unset git config variablesYann Droneaud, Mar 24, 2013
  42. 13/15 t7600: use test_config to set/unset git config variablesYann Droneaud, Mar 24, 2013
  43. 14/15 t9500: use test_config to set/unset git config variablesYann Droneaud, Mar 24, 2013
  44. 15/15 t7502: remove clear_configYann Droneaud, Mar 24, 2013
  45. Junio C HamanoMar 27, 2013
  46. Junio C HamanoMar 27, 2013
  47. Yann DroneaudMar 27, 2013
  48. Junio C HamanoMar 22, 2013
  49. t7600: merge tag shoud create a merge commity@quest-ce.net, Mar 22, 2013
  50. t7600: merge tag shoud create a merge commity@quest-ce.net, Mar 22, 2013
  51. Junio C HamanoMar 22, 2013
  52. Yann DroneaudMar 22, 2013
  53. Jeff KingMar 22, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.