Re: git add -p does not work with custom comment char currently
- From
Jeff King <peff@peff.net>
- Date
- Jun 21, 2017, 18:20 UTC
- Message-ID
- <20170621182020.ywopkykzdfhlxi5o@sigill.intra.peff.net>
- In-Reply-To
- <89d4e348-167e-b201-d243-63b1156b9ed0@croesch.de>
On Wed, Jun 21, 2017 at 06:31:34PM +0200, Christian Rösch wrote:
Show 20 quoted lines
> [core] > commentchar = $ > > as far as I can see with 2.13.0 and 2.13.1.516.g05ec6e1 (built from > source) if I do > > $ git add -p > > and edit the hunk manually the comment char is not parsed correctly: > > Stage this hunk [y,n,q,a,d,/,s,e,?]? e > warning: recount: unexpected line: $ Manual hunk edit mode -- see bottom > for a quick guide. > > error: corrupt patch at line 6 > Your edited hunk does not apply. Edit again (saying "no" discards!) [y/n]? n > > > As far as I can tell this is a bug but it would be nice if you could let > me know if it works for you with a custom comment char.
I can reproduce easily here with the script below. It looks like a regression in c9d961647 (i18n: add--interactive: mark edit_hunk_manually message for translation, 2016-12-14), which is in v2.12.0. It taught the script to write out with the comment char, but reading it back does not seem to work.
Here's my reproduction script:
-- >8 -- rm -rf repo
git init repo cd repo git config core.commentchar '$'
seq 10 >file git add file git commit -m base perl -pi -e 'print "new\n" if $. == 5' file (echo e; echo n) | GIT_EDITOR=true git.compile add -p # look for "corrupt patch" in the output -- 8< --
I think there's another bug, too, where the "patch did not apply cleanly" prompt goes into an infinite loop if it gets EOF.
-Peff