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

Re: What can cause empty GIT_AUTHOR_NAME for 'git filter-branch --tree-filter' on Solaris?

From
Jeff King <peff@peff.net>
Date
Oct 17, 2012, 22:09 UTC
Message-ID
<20121017220912.GA21742@sigill.intra.peff.net>
In-Reply-To
<1013956402.20121017125847@gmail.com>
On Wed, Oct 17, 2012 at 12:58:47PM +0400, Ilya Basin wrote:
Show 18 quoted lines
> JS> Most likely, your sed has problems with a sed script in function
> JS> get_author_ident_from_commit. I tested it like this:
> 
> JS> $ sh -c '. $(git --exec-path)/git-sh-setup;
> JS>                 get_author_ident_from_commit HEAD'
> JS> GIT_AUTHOR_NAME='Johannes Sixt'
> JS> GIT_AUTHOR_EMAIL='j6t@kdbg.org'
> JS> GIT_AUTHOR_DATE='@1350025129 +0200'
> 
> JS> -- Hannes
> 
> Both systems have GNU sed 4.2.1 installed. I wrote a wrapper script wor sed.
> It's output attached.
> The difference is letter case in sed input data:
> Solaris:
>   /^AUTHOR /
> Windows:
>   /^author /

Ah, so it's tr that is the culprit. We've had problems with Solaris tr before, but usually around NULs or the use of brackets. But according to 40a7ce6 (tr portability fixes, 2008-03-12), filter-branch is already doing it the portable way.

If you apply this patch, does your filter-branch work?
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 178e453..58b1d69 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -68,8 +68,8 @@ set_ident () {
 # "author" or "committer
 
 set_ident () {
-	lid="$(echo "$1" | tr "[A-Z]" "[a-z]")"
-	uid="$(echo "$1" | tr "[a-z]" "[A-Z]")"
+	lid="$(echo "$1" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz)"
+	uid="$(echo "$1" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ)"
 	pick_id_script='
 		/^'$lid' /{
 			s/'\''/'\''\\'\'\''/g

That seems like crazy overkill, but it at least will let us double-check
that the tr sequences are the problem.

-Peff
Previous: Jeff KingNext: Johannes Sixt
Message 7 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.