git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* git add -p breaks after split on change at the top of the file
@ 2017-08-16 20:25 Simon Ruderich
  2017-08-17  8:41 ` Jeff King
  0 siblings, 1 reply; 8+ messages in thread
From: Simon Ruderich @ 2017-08-16 20:25 UTC (permalink / raw)
  To: git

Hello,

The following session reproduces the issue with Git 2.14.1:

    $ git init test
    $ cd test
    $ echo x >file
    $ git add file
    $ git commit -m commit
    $ printf 'a\nb\nx\nc\n' >file

    $ git add -p
    diff --git a/file b/file
    index 587be6b..74a69a0 100644
    --- a/file
    +++ b/file
    @@ -1 +1,4 @@
    +a
    +b
     x
    +c
    Stage this hunk [y,n,q,a,d,/,s,e,?]? <-- press s
    Split into 2 hunks.
    @@ -1 +1,3 @@
    +a
    +b
     x
    Stage this hunk [y,n,q,a,d,/,j,J,g,e,?]? <-- press e

    Now delete the line "+a" in your editor and save.

    error: patch failed: file:1
    error: file: patch does not apply

I expected git add -p to stage this change without error. It
works fine without splitting the hunk (by deleting the first and
last + line in the diff).

Regards
Simon
-- 
+ privacy is necessary
+ using gnupg http://gnupg.org
+ public key id: 0x92FEFDB7E44C32F9

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-08-20 16:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-16 20:25 git add -p breaks after split on change at the top of the file Simon Ruderich
2017-08-17  8:41 ` Jeff King
2017-08-17  9:03   ` Jeff King
2017-08-17  9:15     ` Jeff King
2017-08-17 19:22       ` Junio C Hamano
2017-08-20  8:19         ` Jeff King
2017-08-20 16:25           ` Junio C Hamano
2017-08-17 19:08   ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).