git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Arnaud Lacombe <lacombar@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [ANNOUNCE] Git 1.7.4.3
Date: Wed, 6 Apr 2011 14:40:29 -0400	[thread overview]
Message-ID: <BANLkTimh+--iRNEpr2XOFf4jXoVhmHUnoA@mail.gmail.com> (raw)
In-Reply-To: <7v4o6fg29j.fsf@alter.siamese.dyndns.org>

Hi Julio,,

On Sun, Apr 3, 2011 at 4:36 AM, Junio C Hamano <gitster@pobox.com> 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

  reply	other threads:[~2011-04-06 18:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-03  8:36 [ANNOUNCE] Git 1.7.4.3 Junio C Hamano
2011-04-06 18:40 ` Arnaud Lacombe [this message]
2011-04-06 19:58   ` Junio C Hamano
2011-04-06 20:09     ` "add -p" breakage Junio C Hamano
2011-04-06 21:31       ` [PATCH] add--interactive.perl: factor out repeated --recount option Junio C Hamano
2011-04-06 21:36         ` [PATCH] "add -p": work-around an old laziness that does not coalesce hunks Junio C Hamano

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BANLkTimh+--iRNEpr2XOFf4jXoVhmHUnoA@mail.gmail.com \
    --to=lacombar@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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.
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).