Re: [TopGit PATCH] tg-create.sh: Support for multiple {to,cc,bcc} options

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

 



  Hi,

On Thu, Aug 07, 2008 at 10:31:26PM +0200, Bert Wesarg wrote:
> Git config supports multiple values for the same config key, so support it
> for these TopGit config options, too.
> 
> Signed-off-by: Bert Wesarg <bert.wesarg@xxxxxxxxxxxxxx>
> 
> ---
>  tg-create.sh |   17 ++++++++++++++---
>  1 files changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/tg-create.sh b/tg-create.sh
> index 6cce7ed..d47959b 100644
> --- a/tg-create.sh
> +++ b/tg-create.sh
> @@ -100,13 +100,24 @@ git checkout -b "$name"
>  echo "$deps" | sed 's/ /\n/g' >"$root_dir/.topdeps"
>  git add "$root_dir/.topdeps"
>  
> +# Print each config value for a key ($1, without "topgit." prefix)
> +# with the given prefix ($2)
> +get_multi_config()
> +{
> +	# escape any / in prefix for sed
> +	prefix="$(echo "$2" | sed -e 's/\//\\\\\//g')"

Maybe use s### ? ;-)

> +
> +	git config --get-all topgit.$1 2>/dev/null |
> +		sed -e "s/^/$prefix /g"
> +}

Won't this return an error code and terminate the script in case no
option is defined? And why the stderr redirect?

>  author="$(git var GIT_AUTHOR_IDENT)"
>  author_addr="${author%> *}>"
>  {
>  	echo "From: $author_addr"
> -	! header="$(git config topgit.to)" || echo "To: $header"
> -	! header="$(git config topgit.cc)" || echo "Cc: $header"
> -	! header="$(git config topgit.bcc)" || echo "Bcc: $header"
> +	get_multi_config to  "To:"
> +	get_multi_config cc  "Cc:"
> +	get_multi_config bcc "Bcc:"
>  	! subject_prefix="$(git config topgit.subjectprefix)" || subject_prefix="$subject_prefix "
>  	echo "Subject: [${subject_prefix}PATCH] $name"
>  	echo

One trouble here is that I've seen mailers mess up when there is
multiple occurences of these headers, so it would be probably safer to
concatenate them all to single line, comma-separated.

-- 
				Petr "Pasky" Baudis
The next generation of interesting software will be done
on the Macintosh, not the IBM PC.  -- Bill Gates
--
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