From: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
To: Remi LESPINET <remi.lespinet@ensimag.grenoble-inp.fr>
Cc: git@vger.kernel.org
Subject: Re: [RFC] solving a bug with hunks starting at line 1 in git apply
Date: Mon, 01 Jun 2015 20:20:09 +0200 [thread overview]
Message-ID: <vpq382b47fq.fsf@anie.imag.fr> (raw)
In-Reply-To: <87k2vnqrv8.fsf@ensimag.grenoble-inp.fr> (Remi LESPINET's message of "Mon, 01 Jun 2015 19:07:55 +0200")
Remi LESPINET <remi.lespinet@ensimag.grenoble-inp.fr> writes:
> ======================================================================
> = 2. Correction
> ======================================================================
>
> I see mainly two ways to fix the bug:
>
> ********************************************************************
> * 2.1 first method (the most basic)
> ********************************************************************
>
> The most basic is to change the code so that the special behavior
> only affects the hunks of the form
>
> @@ -1,k +1,m @@
I do not think that this would work in all cases. It seems git apply has
issues with overlapping contexts, not just with hunks starting at line
1. See:
$ cat pre.txt
-1
0
10
20
30
40
$ cat p2.diff
--- pre.txt
+++ pre.txt
@@ -2,2 +2,3 @@
0
+5
10
@@ -3,3 +4,3 @@
10
+15
-20
30
$ git apply p2.diff
error: patch failed: pre.txt:3
error: pre.txt: patch does not apply
$ patch < p2.diff
patching file pre.txt
$ cat pre.txt
-1
0
5
10
15
30
40
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
prev parent reply other threads:[~2015-06-01 18:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-01 17:07 [RFC] solving a bug with hunks starting at line 1 in git apply Remi LESPINET
2015-06-01 17:16 ` Junio C Hamano
2015-06-01 17:30 ` Junio C Hamano
2015-06-01 18:00 ` Matthieu Moy
2015-06-01 18:37 ` Junio C Hamano
2015-06-01 18:47 ` Matthieu Moy
2015-06-01 18:53 ` Junio C Hamano
2015-06-01 21:37 ` Remi Lespinet
2015-06-01 18:20 ` Matthieu Moy [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=vpq382b47fq.fsf@anie.imag.fr \
--to=matthieu.moy@grenoble-inp.fr \
--cc=git@vger.kernel.org \
--cc=remi.lespinet@ensimag.grenoble-inp.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.