git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Oct 18, 2012, 07:49 UTC
Message-ID
<507FB470.2060404@viscovery.net>
In-Reply-To
<20121018072535.GB9999@sigill.intra.peff.net>
Am 10/18/2012 9:25, schrieb Jeff King:
Show 39 quoted lines
> -# 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
Previous: Jeff KingNext: Jeff King
Message 20 of 24 in “What can cause empty GIT_AUTHOR_NAME for 'git filter-branch --tree-filter' on Solaris?”
  1. Ilya BasinOct 17, 2012
  2. Jeff KingOct 17, 2012
  3. Johannes SixtOct 17, 2012
  4. Re[2]: What can cause empty GIT_AUTHOR_NAME for 'git filter-branch --tree-filter' on Solaris?Ilya Basin, Oct 17, 2012
  5. Re[3]: What can cause empty GIT_AUTHOR_NAME for 'git filter-branch --tree-filter' on Solaris?Ilya Basin, Oct 17, 2012
  6. Jeff KingOct 17, 2012
  7. Jeff KingOct 17, 2012
  8. Johannes SixtOct 18, 2012
  9. Jeff KingOct 18, 2012
  10. Junio C HamanoOct 18, 2012
  11. Jeff KingOct 18, 2012
  12. 0/2 clean up filter-branch ident parsingJeff King, Oct 18, 2012
  13. 1/2 git-sh-setup: refactor ident-parsing functionsJeff King, Oct 18, 2012
  14. Junio C HamanoNov 12, 2012
  15. Jeff KingNov 12, 2012
  16. Junio C HamanoNov 12, 2012
  17. Jeff KingNov 12, 2012
  18. Junio C HamanoNov 12, 2012
  19. 2/2 filter-branch: use git-sh-setup's ident parsing functionsJeff King, Oct 18, 2012
  20. Johannes SixtOct 18, 2012
  21. Jeff KingOct 18, 2012
  22. Jeff KingOct 18, 2012
  23. Jeff KingOct 18, 2012
  24. 2/2 filter-branch: use git-sh-setup's ident parsing functionsJeff King, Oct 18, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.