Re: [PATCHv2 11/14] completion: let 'for-each-ref' sort remote branches for 'checkout' DWIMery

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

 



On Thu, Mar 23, 2017 at 04:29:21PM +0100, SZEDER Gábor wrote:

> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 394dcece6..d26312899 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -423,8 +423,9 @@ __git_refs ()
>  			# Try to find a remote branch that matches the completion word
>  			# but only output if the branch name is unique
>  			__git for-each-ref --format="%(refname:strip=3)" \
> +				--sort="refname:strip=3" \
>  				"refs/remotes/*/$match*" "refs/remotes/*/$match*/**" | \
> -			sort | uniq -u
> +			uniq -u

I wonder if it would be worth adding a "--unique" option to
for-each-ref. I guess the definition of "unique" may change though (here
you'd want to do it on the sort key, but other cases may want unique
branch names sorted by time, which is less trivial).

-Peff



[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]