Thread (9 messages) flat view 9 messages, 3 authors, 2016-06-15

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

From: Jeff King <hidden>
Date: 2016-06-15 22:55:03
Subsystem: the rest · Maintainer: Linus Torvalds

On Wed, Oct 17, 2012 at 12:58:47PM +0400, Ilya Basin wrote:
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help