From: Phillip Wood <phillip.wood123@gmail.com>
To: "D. Ben Knoble" <ben.knoble@gmail.com>,
Greg Hurrell via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Greg Hurrell <greg.hurrell@datadoghq.com>
Subject: Re: [PATCH] git-jump: make `diff` work with filenames containing spaces
Date: Sun, 10 Aug 2025 14:20:13 +0100 [thread overview]
Message-ID: <3f9eb0ed-576d-451a-93db-9b9508c99c27@gmail.com> (raw)
In-Reply-To: <cc90fefd-9234-4fb7-a00e-96c4004ddace@gmail.com>
On 10/08/2025 11:09, Phillip Wood wrote:
> On 09/08/2025 15:44, D. Ben Knoble wrote:
>> On Fri, Aug 8, 2025 at 1:43 PM Greg Hurrell via GitGitGadget
>> <gitgitgadget@gmail.com> wrote:
>>> From: Greg Hurrell <greg.hurrell@datadoghq.com>
>>>
>>> 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".
When I wrote earlier I forgot that git quotes filenames with control
characters. If a name contains a tab it it quoted and so cases 2 and 3
will be quoted and so there is no ambiguity when trimming a literal tab
character from the end. I haven't checked but I suspect git-jump does
not handle quoted filenames, if we wanted to add support it should be
pretty easy as Git.pm has a function to do the unquoting for us.
Thanks
Phillip
>>>
>>> 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
next prev parent reply other threads:[~2025-08-10 13:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-08 17:42 [PATCH] git-jump: make `diff` work with filenames containing spaces Greg Hurrell via GitGitGadget
2025-08-09 14:44 ` D. Ben Knoble
2025-08-10 10:09 ` Phillip Wood
2025-08-10 13:20 ` Phillip Wood [this message]
2025-08-14 23:14 ` Jeff King
2025-08-15 15:51 ` Phillip Wood
2025-08-10 0:03 ` Junio C Hamano
2025-08-11 11:55 ` [PATCH v2] " Greg Hurrell via GitGitGadget
2025-08-11 13:16 ` Phillip Wood
2025-08-11 21:05 ` D. Ben Knoble
2025-08-14 23:18 ` Jeff King
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=3f9eb0ed-576d-451a-93db-9b9508c99c27@gmail.com \
--to=phillip.wood123@gmail.com \
--cc=ben.knoble@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=greg.hurrell@datadoghq.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).