Nathan Collins <nathan.coll...@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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to