On Wed, May 7, 2014 at 11:42 AM, Junio C Hamano <gits...@pobox.com> wrote:
> Nathan Collins <nathan.coll...@gmail.com> writes:

>> For (2), the solution may be to add a separate
>> 'diff.add-clickable-paths' option (probably there is a better name?
>> 'diff.add-copyable-paths'? ...),...
>> ...
>> Concretely, if 'diff.add-clickable-paths' is set, then instead of e.g.
>>   diff --git a/src/Data/Function/Decorator/Memoizer/Unsafe.hs
>> b/src/Data/Function/Decorator/Memoizer
>>   index 3ef17da..a0586d3 100644
>>   --- a/src/Data/Function/Decorator/Memoizer/Unsafe.hs
>>   +++ b/src/Data/Function/Decorator/Memoizer/Unsafe.hs
> If you do something along that line, perhaps
>         Index: src/Data/Function/Decorator/Memoizer/Unsafe.hs
>         diff --git a/src/Data/Function/Decorator/Memoizer/Unsafe.hs ...
>         index 3ef17da..a0586d3 100644
>         --- a/src/Data/Function/Decorator/Memoizer/Unsafe.hs
>         +++ b/src/Data/Function/Decorator/Memoizer/Unsafe.hs
> to imitate what "cvs diff" does may be more familar to people.
> What would you propose to make clickable in a renaming diff, though?

Your 'Index' header looks good, and I would expect a renaming diff to
have something like

  Index: foo -> bar

as in 'git status', but I just realized that a "clickable paths"
option already exists in some sense! There is a '--patch-with-raw'
option (which is "short" for '--patch' and '--raw', hahaha) which
inserts clickable file names in the patch, above each diff.  Moreover,
it respects the '--relative' option, so you can get relative or
absolute (relative repo root) clickable paths. It handles renaming by
inserting the old and new paths separated by space.

So then, having a way to make '--patch-with-raw' the default for all
non-plumbing patch-producing commands would solve the clickable paths

In a summary, a possible complete solution:

1. improve Git apply error message: mention '-p$n' and '-p1' default,
   and report if path in patch makes sense for some non-default '-p'

2. improve 'diff.noprefix' documentation: tell user that this option
   is for producing '-p0' patches, and that using it to produce
   clickable paths is insane and may cause problems with generated
   patches.  Suggest the user use '--patch-with-raw', and possibly
   '--relative', instead, or refer to (3).

3. add a Git config for making '--patch-with-raw' and optionally
   '--relative' the default for non-plumbing patch-producing commands.


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