Subject: "git fmt-merge-msg" usage (was [PATCH v2 00/46] "struct pathspec" conversion and :(glob) and :(icase))

From: Michael Haggerty <[email-masked]>
Date: Fri, 16 Aug 2013 16:07:43 +0200

On 07/15/2013 11:43 PM, Junio C Hamano wrote:
> [...]
> This was a good exercise for git-imerge.[...]
> 
> A few things I noticed:
>  [...]
> 
>  - The final step "imerge finish" gave me this ugliness:
> 
>      Merge commit 93d9353... into commit cb5d2fc7
> 
>    Perhaps you can at least use the initial branch name
>    "nd/magic-pathspec" I gave you, and use "git fmt-merge-msg"?

I tried to implement this but it is not obvious from the documentation
(to say the least) how to use "git fmt-merge-msg".  It appears that this
program takes, on standard input, something like

    <sha1> TAB TAB <text1> LF
    <sha1> TAB TAB <text2> LF
    <sha1> TAB TAB <text3> LF
    ...

(the two TABs are required!).  Then the <text> is somehow stuck in the
first line of the merge log message, like

    Merge <text1>; <text3>

except apparently the second line is omitted.  If somebody would explain
to me the point of this and how it is intended to be used, then I
volunteer to improve the documentation.

But a bit of the magic of these merge messages is how the <text> are
generated in the first place; e.g.,

    refs/heads/foo -> "branch 'foo'"
    refs/remotes/bar/baz -> "remote-tracking branch 'bar/baz'"

Is this magic available via any Git commands, or do I have to replicate it?

I'm sorely tempted to have git-imerge do a throw-away "git merge" of the
two branch tips just to have Git generate a full merge commit message
for me (it might even be nice to include the list of the files that
would have conflicted).

Thanks,
Michael

-- 
Michael Haggerty
[email-masked]
http://softwareswirl.blogspot.com/