Subject: Re: [PATCH] git-jump: make `diff` work with filenames containing spaces

From: Phillip Wood <[email-masked]>
Date: Sun, 10 Aug 2025 11:09:19 +0100

On 09/08/2025 15:44, D. Ben Knoble wrote:
> On Fri, Aug 8, 2025 at 1:43 PM Greg Hurrell via GitGitGadget
> <[email-masked]> wrote:
>> From: Greg Hurrell <[email-masked]>
>>
>> This commit takes the simple approach of unconditionally stripping any
>> trailing tab. Consider the following three examples:
>>
>> 1. For file "foo bar", Git will emit "foo bar\t".
>> 2. For file "foo\t", Git will emit "foo\t".
>> 3. For file "foo bar\t", Git will emit "foo bar\t\t".
>>
>> Before this commit, `git-jump` correctly handled only case "2".
>>
>> After this commit, `git-jump` correctly handles cases "1" and "3". In
>> reality, "1" is the only case people are going to run into with any
>> regularity, and the other two are extreme edge cases.
> 
> So we drop support for case 2? Hm. I personally try to avoid this
> situation anyway, but it would be nice if we could just do the right
> thing here.
> Or maybe we should consider trying to parse --patch-with-raw output
> for the filenames?

An alternative would be to parse the filename from the "diff --git" line 
like "git apply" does. As we're generating the diff with "--no-prefix" 
that should be straight forward as the line is "diff --git <name> 
<name>" where <name> is the name of the post-image file unless it is a 
deletion in which case it is the name of the pre-image file. We'd still 
need to check the "+++ " line or look for a "deleted file mode" line to 
handle deletions.

Thanks

Phillip