Re: What can cause empty GIT_AUTHOR_NAME for 'git filter-branch --tree-filter' on Solaris?
Jeff King p...@peff.net writes: On Thu, Oct 18, 2012 at 07:31:35AM +0200, Johannes Sixt wrote: Right. But we should really be doing something like this instead to save a few subprocesses. [...] -eval $(set_ident AUTHOR ../commit) || +eval $(set_ident AUTHOR author ../commit) || I cringe a little at losing DRY-ness to avoid processes. Well, the header field token author and the middle word of the variable GIT_AUTHOR_NAME _happen_ to be the same modulo case, but they did not have to be, so you could argue the updated set_ident implementation is more generally useful (you could even argue that we should spell the first parameter out as GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL, two separate parameters). Speaking of repetition, this seems like almost the exact same parsing that happens in git-sh-setup's get_author_ident_from_commit. Maybe it's worth merging them. I suspect you could also avoid another process by parsing out both author and committer information in the same sed invocation. Yes, yes and yes. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: What can cause empty GIT_AUTHOR_NAME for 'git filter-branch --tree-filter' on Solaris?
On Wed, Oct 17, 2012 at 11:06:11PM -0700, Junio C Hamano wrote: - eval $(set_ident AUTHOR ../commit) || + eval $(set_ident AUTHOR author ../commit) || I cringe a little at losing DRY-ness to avoid processes. Well, the header field token author and the middle word of the variable GIT_AUTHOR_NAME _happen_ to be the same modulo case, but they did not have to be, so you could argue the updated set_ident implementation is more generally useful (you could even argue that we should spell the first parameter out as GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL, two separate parameters). True, though that is even more work for the caller (and *_DATE, too). We could make it GIT_AUTHOR, but I don't think there is much point in being that level of half-way general. The caller can always pick it out of the variables if they really want to do something tricky. Speaking of repetition, this seems like almost the exact same parsing that happens in git-sh-setup's get_author_ident_from_commit. Maybe it's worth merging them. I suspect you could also avoid another process by parsing out both author and committer information in the same sed invocation. Yes, yes and yes. Working on it now. git-sh-setup works, but chasing an annoying bug in filter-branch. I'm sure it's something silly and stupid. -Peff -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
What can cause empty GIT_AUTHOR_NAME for 'git filter-branch --tree-filter' on Solaris?
The filter-branch command, the contents of ~/.gitconfig and the tree are the same. The command succeeds on cygwin, but fails on Solaris due to unset GIT_AUTHOR_NAME and GIT_COMMITTER_NAME : $ git filter-branch --tree-filter env | grep GIT_ ; $CMD b416b9bfc5e71531f2f05af4c396bb0ba7560741..HEAD Rewrite 214efc6eec82b015aefe23b2280979f05b351396 (1/16)GIT_DIR=/home/tester/.ilya/builds/makepkg.rap_0.1-1_sparc.XX/src/rap/.git GIT_INDEX_FILE=/home/tester/.ilya/builds/makepkg.rap_0.1-1_sparc.XX/src/rap/.git-rewrite/t/../index GIT_WORK_TREE=. GIT_AUTHOR_NAME= GIT_COMMITTER_NAME= GIT_COMMIT=214efc6eec82b015aefe23b2280979f05b351396 fatal: empty ident m...@email.com not allowed could not write rewritten commit If I explicitly set these 2 variables, filter-branch succeeds, but other commit attributes like commit date aren't preserved. I use git 1.7.6, from sunfreeware. I hope there is some simple thing that needs to be configured. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: What can cause empty GIT_AUTHOR_NAME for 'git filter-branch --tree-filter' on Solaris?
On Wed, Oct 17, 2012 at 10:47:29AM +0400, Ilya Basin wrote: The filter-branch command, the contents of ~/.gitconfig and the tree are the same. The command succeeds on cygwin, but fails on Solaris due to unset GIT_AUTHOR_NAME and GIT_COMMITTER_NAME : That shouldn't happen. The likely culprit is that the sed magic in the set_ident function of git-filter-branch is not portable to your version of sed. What happens if you run this: echo 'author Your Name y...@example.com 1350408529 -0400' commit set -- author 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 commit in your shell? You should get: GIT_AUTHOR_NAME='Your Name'; export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL='y...@example.com'; export GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE='@1350408529 -0400'; export GIT_AUTHOR_DATE I use git 1.7.6, from sunfreeware. It might also be worth testing v1.7.12, but reading the logs, I don't think there has been any meaningful update to filter-branch since then. -Peff -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: What can cause empty GIT_AUTHOR_NAME for 'git filter-branch --tree-filter' on Solaris?
Am 10/17/2012 8:47, schrieb Ilya Basin: The filter-branch command, the contents of ~/.gitconfig and the tree are the same. The command succeeds on cygwin, but fails on Solaris due to unset GIT_AUTHOR_NAME and GIT_COMMITTER_NAME : $ git filter-branch --tree-filter env | grep GIT_ ; $CMD b416b9bfc5e71531f2f05af4c396bb0ba7560741..HEAD Rewrite 214efc6eec82b015aefe23b2280979f05b351396 (1/16)GIT_DIR=/home/tester/.ilya/builds/makepkg.rap_0.1-1_sparc.XX/src/rap/.git GIT_INDEX_FILE=/home/tester/.ilya/builds/makepkg.rap_0.1-1_sparc.XX/src/rap/.git-rewrite/t/../index GIT_WORK_TREE=. GIT_AUTHOR_NAME= GIT_COMMITTER_NAME= GIT_COMMIT=214efc6eec82b015aefe23b2280979f05b351396 fatal: empty ident m...@email.com not allowed could not write rewritten commit Most likely, your sed has problems with a sed script in function get_author_ident_from_commit. I tested it like this: $ sh -c '. $(git --exec-path)/git-sh-setup; get_author_ident_from_commit HEAD' GIT_AUTHOR_NAME='Johannes Sixt' GIT_AUTHOR_EMAIL='j...@kdbg.org' GIT_AUTHOR_DATE='@1350025129 +0200' -- Hannes -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re[2]: What can cause empty GIT_AUTHOR_NAME for 'git filter-branch --tree-filter' on Solaris?
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='j...@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 / -- $ git filter-branch -f --tree-filter env | grep GIT_; true HEAD~1..HEAD SED BEGIN SED ARGUMENTS: -e s/-/ / SED STDIN BEGIN git-filter-branch SED STDIN END SED OUTPUT BEGIN git filter-branch SED OUTPUT END SED EXIT CODE: 0 SED END SED BEGIN SED ARGUMENTS: -e /^^/d /cygdrive/c/sicap/rap/gitcvs/RAP27/.git-rewrite/raw-heads SED INPUT FILE BEGIN: /cygdrive/c/sicap/rap/gitcvs/RAP27/.git-rewrite/raw-heads refs/heads/master SED INPUT FILE END: /cygdrive/c/sicap/rap/gitcvs/RAP27/.git-rewrite/raw-heads SED OUTPUT BEGIN refs/heads/master SED OUTPUT END SED EXIT CODE: 0 SED END Rewrite acd1d2bb1984c96630d5070497590307151c4682 (1/1) SED BEGIN SED ARGUMENTS: -ne /^author /{ s/'/'\\''/g h s/^author \([^]*\) [^]* .*$/\1/ s/'/'\''/g s/.*/GIT_AUTHOR_NAME=''; export GIT_AUTHOR_NAME/p g s/^author [^]* \([^]*\) .*$/\1/ s/'/'\''/g s/.*/GIT_AUTHOR_EMAIL=''; export GIT_AUTHOR_EMAIL/p g s/^author [^]* [^]* \(.*\)$/\1/ s/'/'\''/g s/.*/GIT_AUTHOR_DATE=''; export GIT_AUTHOR_DATE/p q } SED STDIN BEGIN tree 969f563d319049bb6dabc12054d67671499a6f55 parent c4734950e37c09ca7d3e3088f6f31d866dbb5077 author Ilya Basin basini...@gmail.com 1350401059 +0400 committer Ilya Basin basini...@gmail.com 1350405585 +0400 temp SED STDIN END SED OUTPUT BEGIN GIT_AUTHOR_NAME='Ilya Basin'; export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL='basini...@gmail.com'; export GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE='1350401059 +0400'; export GIT_AUTHOR_DATE SED OUTPUT END SED EXIT CODE: 0 SED END SED BEGIN SED ARGUMENTS: -ne /^committer /{ s/'/'\\''/g h s/^committer \([^]*\) [^]* .*$/\1/ s/'/'\''/g s/.*/GIT_COMMITTER_NAME=''; export GIT_COMMITTER_NAME/p g s/^committer [^]* \([^]*\) .*$/\1/ s/'/'\''/g s/.*/GIT_COMMITTER_EMAIL=''; export GIT_COMMITTER_EMAIL/p g s/^committer [^]* [^]* \(.*\)$/\1/ s/'/'\''/g s/.*/GIT_COMMITTER_DATE=''; export GIT_COMMITTER_DATE/p q } SED STDIN BEGIN tree 969f563d319049bb6dabc12054d67671499a6f55 parent c4734950e37c09ca7d3e3088f6f31d866dbb5077 author Ilya Basin basini...@gmail.com 1350401059 +0400 committer Ilya Basin basini...@gmail.com 1350405585 +0400 temp SED STDIN END SED OUTPUT BEGIN GIT_COMMITTER_NAME='Ilya Basin'; export GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL='basini...@gmail.com'; export GIT_COMMITTER_EMAIL GIT_COMMITTER_DATE='1350405585 +0400'; export GIT_COMMITTER_DATE SED OUTPUT END SED EXIT CODE: 0 SED END GIT_DIR=/cygdrive/c/sicap/rap/gitcvs/RAP27/.git GIT_AUTHOR_DATE=1350401059 +0400 GIT_INDEX_FILE=/cygdrive/c/sicap/rap/gitcvs/RAP27/.git-rewrite/t/../index GIT_WORK_TREE=. GIT_AUTHOR_NAME=Ilya Basin GIT_COMMITTER_NAME=Ilya Basin GIT_COMMIT=acd1d2bb1984c96630d5070497590307151c4682 GIT_COMMITTER_EMAIL=basini...@gmail.com GIT_COMMITTER_DATE=1350405585 +0400 GIT_AUTHOR_EMAIL=basini...@gmail.com SED BEGIN SED ARGUMENTS: -e 1,/^$/d SED STDIN BEGIN tree 969f563d319049bb6dabc12054d67671499a6f55 parent c4734950e37c09ca7d3e3088f6f31d866dbb5077 author Ilya Basin basini...@gmail.com 1350401059 +0400 committer Ilya Basin basini...@gmail.com 1350405585 +0400 temp SED STDIN END SED OUTPUT BEGIN temp SED OUTPUT END SED EXIT CODE: 0 SED END WARNING: Ref 'refs/heads/master' is unchanged -bash-3.00$ git filter-branch -f --tree-filter env | grep GIT_; true HEAD~1..HEAD SED BEGIN SED ARGUMENTS: -e s/-/ / SED STDIN BEGIN git-filter-branch SED STDIN END SED OUTPUT BEGIN git filter-branch SED OUTPUT END SED EXIT CODE: 0 SED END SED BEGIN SED ARGUMENTS: -e /^^/d /home/tester/.ilya/builds/makepkg.rap_0.1-1_sparc.XX/src/rap/.git-rewrite/raw-heads SED INPUT FILE BEGIN: /home/tester/.ilya/builds/makepkg.rap_0.1-1_sparc.XX/src/rap/.git-rewrite/raw-heads refs/heads/master SED INPUT FILE END:
Re[3]: What can cause empty GIT_AUTHOR_NAME for 'git filter-branch --tree-filter' on Solaris?
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='j...@kdbg.org' JS GIT_AUTHOR_DATE='@1350025129 +0200' JS -- Hannes IB Both systems have GNU sed 4.2.1 installed. I wrote a wrapper script wor sed. IB It's output attached. IB The difference is letter case in sed input data: IB Solaris: IB /^AUTHOR / IB Windows: IB /^author / The culprit is bad $PATH : When git-filter-branch runs, for some reason two new entries precede /usr/bin in it: /tmp/777/.ilya-sparc/bin /home/tester/.ilya/opt/SNiFF-3.2.1/bin /export/home/testora/app/testora/product/11.2.0/client_32/bin +/usr/xpg6/bin +/usr/xpg4/bin /usr/bin /home/tester/apache-ant-1.7.1/bin /usr/jdk/instances/jdk1.5.0//bin And /usr/xpg6/bin/tr fails to make AUTHOR lowercase. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: What can cause empty GIT_AUTHOR_NAME for 'git filter-branch --tree-filter' on Solaris?
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='j...@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 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: What can cause empty GIT_AUTHOR_NAME for 'git filter-branch --tree-filter' on Solaris?
On Wed, Oct 17, 2012 at 02:36:23PM +0400, Ilya Basin wrote: The culprit is bad $PATH : When git-filter-branch runs, for some reason two new entries precede /usr/bin in it: /tmp/777/.ilya-sparc/bin /home/tester/.ilya/opt/SNiFF-3.2.1/bin /export/home/testora/app/testora/product/11.2.0/client_32/bin +/usr/xpg6/bin +/usr/xpg4/bin /usr/bin /home/tester/apache-ant-1.7.1/bin /usr/jdk/instances/jdk1.5.0//bin And /usr/xpg6/bin/tr fails to make AUTHOR lowercase. Hmph. Those are controlled by SANE_TOOL_PATH at git's build time, with the intent that the xpg tools are less terrible than the ones in /usr/bin on Solaris. But it sounds like that may not be the case. Yuck. I don't have a Solaris box handy. Is there a way to make sequences like A-Z work sanely with /usr/xpg6/bin/tr? Do you have any LANG or locale settings? Sometimes those can affect sequences. What does: echo AUTHOR | LANG=C LC_ALL=C /usr/xpg6/bin/tr '[A-Z]' '[a-z]' do? -Peff -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: What can cause empty GIT_AUTHOR_NAME for 'git filter-branch --tree-filter' on Solaris?
Am 10/18/2012 0:09, schrieb Jeff King: - 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) That seems like crazy overkill, but it at least will let us double-check that the tr sequences are the problem. Right. But we should really be doing something like this instead to save a few subprocesses. -- Hannes diff --git a/git-filter-branch.sh b/git-filter-branch.sh index 178e453..018e56e 100755 --- a/git-filter-branch.sh +++ b/git-filter-branch.sh @@ -68,8 +68,8 @@ eval $functions # author or committer set_ident () { - lid=$(echo $1 | tr [A-Z] [a-z]) - uid=$(echo $1 | tr [a-z] [A-Z]) + uid=$1 + lid=$2 pick_id_script=' /^'$lid' /{ s/'\''/'\''\\'\'\''/g @@ -320,9 +320,9 @@ while read commit parents; do git cat-file commit $commit ../commit || die Cannot read commit $commit - eval $(set_ident AUTHOR ../commit) || + eval $(set_ident AUTHOR author ../commit) || die setting author failed for commit $commit - eval $(set_ident COMMITTER ../commit) || + eval $(set_ident COMMITTER committer ../commit) || die setting committer failed for commit $commit eval $filter_env /dev/null || die env filter failed: $filter_env -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: What can cause empty GIT_AUTHOR_NAME for 'git filter-branch --tree-filter' on Solaris?
On Thu, Oct 18, 2012 at 07:31:35AM +0200, Johannes Sixt wrote: Right. But we should really be doing something like this instead to save a few subprocesses. [...] - eval $(set_ident AUTHOR ../commit) || + eval $(set_ident AUTHOR author ../commit) || I cringe a little at losing DRY-ness to avoid processes. But the repetition is pretty straightforward and obvious, and I know that some platforms are really hurt by extra processes (and this is being called for every commit). Speaking of repetition, this seems like almost the exact same parsing that happens in git-sh-setup's get_author_ident_from_commit. Maybe it's worth merging them. I suspect you could also avoid another process by parsing out both author and committer information in the same sed invocation. -Peff -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html