Question

Whenever I split a subdirectory into a branch via git subtree split or (consequently?) when I push a subtree upstream, the commit messages in the new branch/upstream commits have "-n" and a newline prepended to them.

It's easiest to demonstrate with split:

git init repo
cd repo
mkdir splitme
touch splitme/foo
git add splitme/
git commit -m 'Add foo'
git subtree split -P splitme -b splitme-only

From this, I get:

$ git log master
commit 6d5164076bd88d1dab8963d91ec013372e58a444
Author: me
Date:   Fri Jul 26 12:22:27 2013 -0500

    Add foo

and

$ git log splitme-only 
commit 6ce8124a0b5e52d4bba198144d2f3f664d7b19e7
Author: me
Date:   Fri Jul 26 12:22:27 2013 -0500

    -n
    Add foo

As you can see, the "splitme-only" branch has "-n" prepended to the commit message. This is particularly bad as github collapses everything but the first line by default. Hence, you can't easily skim these commit messages on github.

I've tried using --annotate to maybe get something more readable, but that just appends something to the "-n" line.

The behavior is identical for subtree push.

Is there any way to prevent the "-n" line from being added? I could rebase the line out, but when I played around with that it broke subtrees merging. Am I doing something wrong?

Using git 1.8.3.4 on OS X 10.8.4.

Was it helpful?

Solution

It turns out it's a bug in git, introduced in 1.8.3.3.

Specifically, this merge made subtree run via sh instead of bash, which breaks this line.

Here's the bug report I just submitted: http://thread.gmane.org/gmane.comp.version-control.git/231213

UPDATE: The bug is fixed in git 1.8.4

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top