Re: [PATCH 3/3] git abbref-ref: new porcelain for abbreviate_ref()

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

 



Bert Wesarg <bert.wesarg@xxxxxxxxxxxxxx> wrote:
> This gives direct access to the abbreviate_ref() function. The operation
> mode defaults to the core.warnambiguousrefs value, like the refname:short
> format, but can be explicitly changed with the --{,no}-strict option.
> 
> The bash completion script utilizes this new command.

And it slows down too, doesn't it?  Now we are doing a fork per
branch during completion.  Yikes.  Didn't you just post a series
about making completion faster?
 
> Junio, if this is not a porcelain, tell me.

IMHO its plumbing.  Porcelain is used by a human.  Plumbing is the
bits needed to make human interfaces.
 
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 93f0881..7f002c0 100755
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -112,9 +112,9 @@ __git_ps1 ()
>  		fi
>  
>  		if [ -n "$1" ]; then
> -			printf "$1" "${b##refs/heads/}$r"
> +			printf "$1" "$(git abbrev-ref $b)$r"
>  		else
> -			printf " (%s)" "${b##refs/heads/}$r"
> +			printf " (%s)" "$(git abbrev-ref $b)$r"
>  		fi
>  	fi
>  }
> @@ -162,7 +162,7 @@ __git_heads ()
>  		case "$is_hash,$i" in
>  		y,*) is_hash=n ;;
>  		n,*^{}) is_hash=y ;;
> -		n,refs/heads/*) is_hash=y; echo "${i#refs/heads/}" ;;
> +		n,refs/heads/*) is_hash=y; echo "$(git abbrev-ref $i)" ;;
>  		n,*) is_hash=y; echo "$i" ;;
>  		esac
>  	done
> @@ -180,7 +180,7 @@ __git_tags ()
>  		case "$is_hash,$i" in
>  		y,*) is_hash=n ;;
>  		n,*^{}) is_hash=y ;;
> -		n,refs/tags/*) is_hash=y; echo "${i#refs/tags/}" ;;
> +		n,refs/tags/*) is_hash=y; echo "$(git abbrev-ref $i)" ;;
>  		n,*) is_hash=y; echo "$i" ;;
>  		esac
>  	done
> @@ -199,9 +199,9 @@ __git_refs ()
>  		case "$is_hash,$i" in
>  		y,*) is_hash=n ;;
>  		n,*^{}) is_hash=y ;;
> -		n,refs/tags/*) is_hash=y; echo "${i#refs/tags/}" ;;
> -		n,refs/heads/*) is_hash=y; echo "${i#refs/heads/}" ;;
> -		n,refs/remotes/*) is_hash=y; echo "${i#refs/remotes/}" ;;
> +		n,refs/tags/*) is_hash=y; echo "$(git abbrev-ref $i)" ;;
> +		n,refs/heads/*) is_hash=y; echo "$(git abbrev-ref $i)" ;;
> +		n,refs/remotes/*) is_hash=y; echo "$(git abbrev-ref $i)" ;;
>  		n,*) is_hash=y; echo "$i" ;;
>  		esac
>  	done
> @@ -222,7 +222,7 @@ __git_refs_remotes ()
>  		case "$is_hash,$i" in
>  		n,refs/heads/*)
>  			is_hash=y
> -			echo "$i:refs/remotes/$1/${i#refs/heads/}"
> +			echo "$i:refs/remotes/$1/$(git abbrev-ref $i)"
>  			;;
>  		y,*) is_hash=n ;;
>  		n,*^{}) is_hash=y ;;

-- 
Shawn.
--
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]

  Powered by Linux