All of lore.kernel.org
 help / color / mirror / Atom feed
From: Federico Cuello <fedux@lugmen.org.ar>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jonathan Nieder <jrnieder@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH] Fix git-apply with -p greater than 1
Date: Fri, 22 Oct 2010 15:51:12 -0300	[thread overview]
Message-ID: <4CC1DD20.1080500@lugmen.org.ar> (raw)
In-Reply-To: <7v8w1qm5n2.fsf@alter.siamese.dyndns.org>

El 22/10/10 15:41, Junio C Hamano escribió:
> Fede <fedux@lugmen.org.ar> writes:
>
>> There is a similar issue with renames and I'm working on that.
> I think I queued a fix-up in 'pu' on top of your patch last night.  Does
> it work for you?

Yes, is almost what I got. I also checked p_value not to be 0.

Anyway, the whole thing is broken when -p 0 , and it requires a little
bit more work. Specially in apply.c:stop_at_slash().

I have this:

diff --git a/builtin/apply.c b/builtin/apply.c
index 14996f8..3197e38 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -919,28 +919,28 @@ static int gitdiff_newfile(const char *line,
struct patch *patch)
 static int gitdiff_copysrc(const char *line, struct patch *patch)
 {
        patch->is_copy = 1;
-       patch->old_name = find_name(line, NULL, 0, 0);
+       patch->old_name = find_name(line, NULL, p_value ? p_value - 1 :
0, 0);
        return 0;
 }
 
 static int gitdiff_copydst(const char *line, struct patch *patch)
 {
        patch->is_copy = 1;
-       patch->new_name = find_name(line, NULL, 0, 0);
+       patch->new_name = find_name(line, NULL, p_value ? p_value - 1 :
0, 0);
        return 0;
 }
 
 static int gitdiff_renamesrc(const char *line, struct patch *patch)
 {
        patch->is_rename = 1;
-       patch->old_name = find_name(line, NULL, 0, 0);
+       patch->old_name = find_name(line, NULL, p_value ? p_value - 1 :
0, 0);
        return 0;
 }
 
 static int gitdiff_renamedst(const char *line, struct patch *patch)
 {
        patch->is_rename = 1;
-       patch->new_name = find_name(line, NULL, 0, 0);
+       patch->new_name = find_name(line, NULL, p_value ? p_value - 1 :
0, 0);
        return 0;
 }

  reply	other threads:[~2010-10-22 18:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-21 22:12 [PATCH] Fix git-apply with -p greater than 1 Federico Cuello
2010-10-22  5:01 ` Junio C Hamano
2010-10-22  5:31   ` Jonathan Nieder
2010-10-22 13:42     ` Fede
2010-10-22 15:38       ` Jonathan Nieder
2010-10-22 18:41       ` Junio C Hamano
2010-10-22 18:51         ` Federico Cuello [this message]
2010-10-25 14:11         ` Federico Cuello
2010-10-22 18:40     ` 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

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

  git send-email \
    --in-reply-to=4CC1DD20.1080500@lugmen.org.ar \
    --to=fedux@lugmen.org.ar \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.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.
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.