All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Nathan Collins <nathan.collins@gmail.com>
Cc: Jonathan Nieder <jrnieder@gmail.com>, git <git@vger.kernel.org>
Subject: Re: [BUG?] Patches created with 'diff.noprefix=true' don't 'git apply'.
Date: Tue, 06 May 2014 14:12:52 -0700	[thread overview]
Message-ID: <xmqqbnvaehm3.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <CAO8RVvfHVBG6QZ5M1DJK4kOX8GMDrvEw4_L=LsEc4G6E0pP7ug@mail.gmail.com> (Nathan Collins's message of "Tue, 6 May 2014 12:36:58 -0700")

Nathan Collins <nathan.collins@gmail.com> writes:

> But 'git apply' could be much more helpful than 'patch' even, since
> the presence or absence of the 'a/' and 'b/' prefixes in the patch,
> and the 'diff.noprefix' setting, give Git enough info to be very
> helpful to the user.

The prefix would be unreliable as the generator may be using the
mnemonicprefix option to use i/ and w/ prefixes.  Worse yet, the
configuration variables are for people who generated the diff you
are feeding "git apply", and there is nothing that tells "apply"
that the patch is generated with _your_ setting.

So that is not workable.

However, Before issuing this error message

>   git -c diff.noprefix=true diff HEAD~ | git apply --reverse
>   error: Data/Function/Decorator/Memoizer/Unsafe.hs: No such file or directory

we _could_ check that there is Data/ directory in the target tree
the patch is being applied and suggest to:

 * "use -p0", if noprefix, which I agree with Jonathan is an insane
   thing to use by default, is common enough; or

 * "use different setting for -p$n", if noprefix is not common.

in the error message.  Extra computation necessary to do so would
happen only in the error codepath, and we wouldn't mind spending
some cycles if they help the end user.

  reply	other threads:[~2014-05-06 21:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-01  1:36 [BUG?] Patches created with 'diff.noprefix=true' don't 'git apply' Nathan Collins
2014-05-01  2:40 ` Jonathan Nieder
2014-05-06  1:33   ` Nathan Collins
2014-05-06  1:59     ` Jonathan Nieder
2014-05-06 18:10     ` Junio C Hamano
2014-05-06 19:36       ` Nathan Collins
2014-05-06 21:12         ` Junio C Hamano [this message]
2014-05-07  1:16           ` Nathan Collins
2014-05-07 18:42             ` Junio C Hamano
2014-05-07 23:39               ` Nathan Collins
2014-05-08  4:38                 ` Nathan Collins
2014-05-08  4:53                   ` Nathan Collins
2014-05-08 16:56                 ` 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=xmqqbnvaehm3.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=nathan.collins@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.