Re: [PATCH] scripts/bash_aliases: man_gitstaged(): Script around a porcelain git command

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

 



Hi Alex,

On 5/10/21 9:38 AM, Alejandro Colomar wrote:
> The output of 'git status' is not stable.
> 
> The more stable 'git status --porcelain' is more complex,
> and scripting around it would be more complex.
> 
> However, 'git diff --staged --name-only' produces
> the output that we were lookiong for.
> 
> Reported-by: Jakub Wilk <jwilk@xxxxxxxxx>
> Signed-off-by: Alejandro Colomar <alx.manpages@xxxxxxxxx>


Applied.

Thanks,

Michael


> ---
>  scripts/bash_aliases | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/scripts/bash_aliases b/scripts/bash_aliases
> index 8cedc4efc..d9b6047d1 100644
> --- a/scripts/bash_aliases
> +++ b/scripts/bash_aliases
> @@ -153,13 +153,11 @@ function pdfman()
>  
>  function man_gitstaged()
>  {
> -	git status							\
> -	|sed "/Changes not staged for commit:/q"			\
> -	|grep -E "^\s*(modified|deleted|new file):"			\
> -	|sed "s/^.*:\s*/, /"						\
> +	git diff --staged --name-only					\
> +	|sed "s/$/, /"							\
>  	|sed "s%man[1-9]/%%"						\
>  	|tr -d '\n'							\
> -	|sed "s/^, //"
> +	|sed "s/, $//"
>  }
>  
>  ########################################################################
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux