Skip to contentSkip to conversation

Rebase will throw away log messages

DISCUSSION Andy Parkins 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Hello,

The thread "[PATCH] have merge put FETCH_HEAD data in commit message" reminded me of a test I wanted to do after Junio told me off ;-) for putting "---

Quoted 1 line

8 ---" in a log message. In particular, the objection was that the "---"

made git-am think the message was at an end. This combined with the talk of git-am in the above thread made me remember that I had more to say about git-am being so picky about what it would allow in the log message.

I just made a repository that looked like this:

* -- * (somebranch)
\
X (master)

Then I did a rebase, while on master

 $ git rebase somebranch

Great; rebase worked as expected in terms of reorganising the repository:

* -- * (somebranch)

       \
        X' (master)

The only thing is this change in the log. Here is X before the rebase:

commit 3030bf9e3f8434dc3634e768f5e0bd54659bed48

Author: Andy Parkins <[email protected]>
Date:   Fri Mar 23 14:49:24 2007 +0000

Short log

Long log; line following this has dashes in it

---

This is after the dashes.

Here is X after the rebase:

commit 575e0c226117d687ae9ba1c3c6b4c8e35cbe5ab7

Author: Andy Parkins <[email protected]>
Date:   Fri Mar 23 14:49:24 2007 +0000

Short log

Long log; line following this has dashes in it

Oh dear. Half the log message has gone missing.

Of course the reason will be obvious to you clever chaps: git-rebase uses git-am to do the work and the "---" line in the original message causes it to drop into "diff starts here mode", and then everything until the "diff --git" line is ignored.

Surely git-am needs a better way of detecting the end of the log that that?

Something more unique than "---" would be a start; "--- [end of log message]" sort of thing.

Although they aren't liked on the git list - emails with the different parts as different attachments would be a much more reliable input for git-am for use in git-rebase.

Andy

Signature · 2 lines
Dr Andy Parkins, M Eng (hons), MIET
[email protected]