Re: [PATCH 2/2] filter-branch: use git-sh-setup's ident parsing functions

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

 



Am 10/18/2012 9:25, schrieb Jeff King:
> -# When piped a commit, output a script to set the ident of either
> -# "author" or "committer
> +# Ensure non-empty id name.
> +fallback_name() {
> +	echo "case \"\$GIT_$1_NAME\" in \"\") GIT_$1_NAME=\"\${GIT_$1_EMAIL%%@*}\" && export GIT_$1_NAME;; esac"
> +}
>  
>  set_ident () {
> -	lid="$(echo "$1" | tr "[A-Z]" "[a-z]")"
> -	uid="$(echo "$1" | tr "[a-z]" "[A-Z]")"
> -	pick_id_script='
> -		/^'$lid' /{
> -			s/'\''/'\''\\'\'\''/g
> -			h
> -			s/^'$lid' \([^<]*\) <[^>]*> .*$/\1/
> -			s/'\''/'\''\'\'\''/g
> -			s/.*/GIT_'$uid'_NAME='\''&'\''; export GIT_'$uid'_NAME/p
> -
> -			g
> -			s/^'$lid' [^<]* <\([^>]*\)> .*$/\1/
> -			s/'\''/'\''\'\'\''/g
> -			s/.*/GIT_'$uid'_EMAIL='\''&'\''; export GIT_'$uid'_EMAIL/p
> -
> -			g
> -			s/^'$lid' [^<]* <[^>]*> \(.*\)$/@\1/
> -			s/'\''/'\''\'\'\''/g
> -			s/.*/GIT_'$uid'_DATE='\''&'\''; export GIT_'$uid'_DATE/p
> -
> -			q
> -		}
> -	'
> -
> -	LANG=C LC_ALL=C sed -ne "$pick_id_script"
> -	# Ensure non-empty id name.
> -	echo "case \"\$GIT_${uid}_NAME\" in \"\") GIT_${uid}_NAME=\"\${GIT_${uid}_EMAIL%%@*}\" && export GIT_${uid}_NAME;; esac"
> +	parse_ident_from_commit author AUTHOR committer COMMITTER
> +	fallback_name AUTHOR
> +	fallback_name COMMITTER
>  }

Didn't you lose the export GIT_$uid_{NAME,EMAIL,DATE} parts somewhere on
the way?

Thanks for working on this!

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