Subject: Re: [PATCH v2] bash: support pretty format aliases

From: SZEDER Gábor <[email-masked]>
Date: Thu, 14 Oct 2010 10:55:38 +0200

On Mon, Oct 11, 2010 at 12:06:22AM +0200, SZEDER Gábor wrote:
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 6756990..4d54c32 100755
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -750,6 +750,19 @@ __git_compute_porcelain_commands ()
>  	: ${__git_porcelain_commands:=$(__git_list_porcelain_commands)}
>  }
>  
> +__git_pretty_aliases ()
> +{
> +	local i IFS=$'\n'
> +	for i in $(git --git-dir="$(__gitdir)" config --get-regexp "pretty\..*" 2>/dev/null); do
> +		case "$i" in
> +		pretty.*)
> +			i="${i#pretty.}"
> +			echo "${i/ */}"
> +			;;
> +		esac
> +	done
> +}
> +
>  __git_aliases ()
>  {
>  	local i IFS=$'\n'
 
If you look at this new __git_pretty_aliases() function and the old
__git_aliases(), then you'll see that it's quite a code duplication.
So, how about the following two patches instead?