Re: [ANNOUNCE] Git 1.7.4.3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Julio,,

On Sun, Apr 3, 2011 at 4:36 AM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Junio C Hamano (9):
>      apply: do not patch lines that were already patched
>
This commit introduces a regression when editing splithunks using "git
add -p". Reverting the patch fix the regression.

Considering the following checked-in code:

int
main(int argc, char **argv)
{
        int a;

        return 0;
}

modified the following way:

int
main(int argc, char **argv)
{
        int c;
        int a;
        int d;
        int e;
        int f;

        return 0;
}

if you 'git add -p' on the file, you'll get:

diff --git a/main.c b/main.c
index f9f4197..7fb483f 100644
--- a/main.c
+++ b/main.c
@@ -9,7 +9,11 @@
 int
 main(int argc, char **argv)
 {
+       int c;
        int a;
+       int d;
+       int e;
+       int f;

        return 0;
 }

Now, I only want the first part, so I reduce the context by typing
's', which lead to:

Split into 2 hunks.
@@ -9,4 +9,5 @@
 int
 main(int argc, char **argv)
 {
+       int c;
        int a;

If I edit this hunk and make _no_modification_, "git apply" fails with:

error: patch failed: main.c:12
error: main.c: patch does not apply
Your edited hunk does not apply. Edit again (saying "no" discards!) [y/n]?

This hunk does _apply_, as it could be staged and committed as-is if I
did not edit it.

This was just a way to reproduce the regression. If you change the
code in a way that would still apply, git-apply would still fails to
apply the hunk. Editing the whole original hunk (ie. not split) works
fine.

 - Arnaud
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]