core.commentchar in rebase causing errors

319 views
Skip to first unread message

Taufiq Hoven

unread,
Nov 18, 2016, 3:52:40 PM11/18/16
to git-for-windows
Hi,

I've recently started using core.commentchar=auto as my team has started to include commits with #issuenumber in the comments. While this has worked fine for commit comments made with git commit -m msg, when I attempt to commit with a straight "git commit" the template still appears to use the default # comment. More confusingly, when I perform an interactive rebase, the comment character appears to be "a" and "#", eg:

...
pick ab5c16062b7ed8870f0360e47ba507334828ec44 #561 remove unused wurm_create_ddl db creation file
pick 5b4e3f513fbc4b5f3a906c21dee7c2d5f253464d #561 moved connection details into builder, removed connection descriptor classes

a Rebase e2a0f53..5b4e3f5 onto e2a0f53 (6 commands)
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
# d, drop = remove commit
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
a Note that empty commits are commented out

which results in:
error: Invalid line 8: a Rebase e2a0f53..5b4e3f5 onto e2a0f53 (6 commands)
error: Invalid line 25: a Note that empty commits are commented out
error: Unusable instruction sheet: .git/rebase-merge/git-rebase-todo
error: Invalid line 8: a Rebase e2a0f53..5b4e3f5 onto e2a0f53 (6 commands)
error: Invalid line 25: a Note that empty commits are commented out

Is there additional configuration I need to set up in order to have the alternative comment characters used?

Thanks,
Taufiq

Johannes Schindelin

unread,
Nov 21, 2016, 9:17:56 AM11/21/16
to Taufiq Hoven, git-for-windows
Hi Taufiq,
This seems to be a straight-forward bug in the implementation of rebase
-i's handling of the special value "auto", as well as ignoring it
completely for the instructions on the bottom.

But since "auto" talks about commit messages, and since it says that it
will use a comment char that is not found as first character of any
existing line, I guess it should fall back to '#' in rebase -i's case,
anyway.

I whipped up a pair of patches that should fix this.

Please note that this is not a Windows-specific issue, therefore I will
send the patches to the Git mailing list instead of the Git for Windows
one.

Ciao,
Johannes

Taufiq Hoven

unread,
Nov 22, 2016, 9:06:34 AM11/22/16
to git-for-windows, taufiq...@gmail.com
Thanks very much, Johannes, it's been great to watch the discussion as the fix has progressed.

Cheers,
Taufiq

Taufiq Hoven

unread,
Dec 3, 2016, 6:55:33 AM12/3/16
to git-for-windows, taufiq...@gmail.com
Just tried Git for Windows 2.11.0, interactive rebase with core.commentchar ; works without issue.

Thanks very much,
Taufiq

Johannes Schindelin

unread,
Dec 5, 2016, 6:50:48 AM12/5/16
to Taufiq Hoven, git-for-windows
Hi Taufiq,

On Sat, 3 Dec 2016, Taufiq Hoven wrote:

> Just tried Git for Windows 2.11.0, interactive rebase with core.commentchar
> ; works without issue.

Thanks for following up!
Johannes
Reply all
Reply to author
Forward
0 new messages