Re: [RFC PATCH] completion: support excluding refs

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

 



Chris Packham <judge.packham@xxxxxxxxx> writes:

> Allow completion of refs with a ^ prefix. This allows completion of
> commands like 'git log HEAD ^origin/master'.
> ...
> +			[[ "$cur" == ^* ]] && pfx="^"
>  			for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD; do
> -				if [ -e "$dir/$i" ]; then echo $i; fi
> +				if [ -e "$dir/$i" ]; then echo $pfx$i; fi
>  			done
>  			format="refname:short"
>  			refs="refs/tags refs/heads refs/remotes"
>  			;;
>  		esac
> -		git --git-dir="$dir" for-each-ref --format="%($format)" \
> +		git --git-dir="$dir" for-each-ref --format="$pfx%($format)" \
>  			$refs

That looks like a reasonable approach to me (but I am no expert in
this area myself).

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



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