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, Sep 15, 2024 at 07:20:24AM -0400, Jeff King wrote:
> diff --git a/contrib/git-jump/git-jump b/contrib/git-jump/git-jump
> index 78e7394406..3f69675961 100755
> --- a/contrib/git-jump/git-jump
> +++ b/contrib/git-jump/git-jump
> @@ -44,7 +44,7 @@ open_editor() {
>  mode_diff() {
>  	git diff --no-prefix --relative "$@" |
>  	perl -ne '
> -	if (m{^\+\+\+ (.*)}) { $file = $1; next }
> +	if (m{^\+\+\+ (.*)}) { $file = $1 eq "/dev/null" ? undef : $1; next }

I was surprised to not see you use `--diff-filter` here, but I think
that that makes sense. You only would want to exclude deletions, since
that would be the only time the post-image is /dev/null AFAICT.

But I guess that would make it impossible to do "git jump diff
--diff-filter", which may be useful in some cases. TBH, I have almost
never used --diff-filter myself, so I'm not sure how common that is.

In any event, this seems to be quite a reasonable implementation to me.

Thanks,
Taylor




[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