Re: [PATCH 2/2] git-jump: ignore deleted files in diff mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 15 Sept 2024 at 13:20, Jeff King <peff@xxxxxxxx> wrote:
>
> If you do something like this:
>
>   rm file_a
>   echo change >file_b
>   git jump diff
>
> then we'll generate two quickfix entries for the diff, one for each
> file. But the one for the deleted file is rather pointless. There's no
> content to show since the file is gone, and in fact we open the editor
> with the path /dev/null!

Ah, yes, I've seen this. I just went "I can see why this would happen"
and moved on to the next hunk. Thanks for actually patching.

> Let's skip such entries entirely. There's nothing useful to show, since
> the point is that the file has been deleted.

Agreed. Anybody who relies on `git jump diff` to produce an empty
quickfix list (no entries to go through) if *and only if* the diff is
empty is already in for a surprise due to binary files. Skipping
/dev/null makes perfect sense.

>         perl -ne '
> -       if (m{^\+\+\+ (.*)}) { $file = $1; next }
> +       if (m{^\+\+\+ (.*)}) { $file = $1 eq "/dev/null" ? undef : $1; next }
>         defined($file) or next;

This looks very reasonable. From my testing, this patch fixes the issue.

Martin




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux