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.XXXXXX/src/rap/.git
GIT_INDEX_FILE=/home/tester/.ilya/builds/makepkg.rap_0.1-1_sparc.XXXXXX/src/rap/.git-rewrite/t/../index
GIT_WORK_TREE=.
GIT_AUTHOR_NAME=
GIT_COMMITTER_NAME=
GIT_COMMIT=214efc6eec82b015aefe23b2280979f05b351396
fatal: empty ident [off-list ref] 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.
From: Jeff King <hidden> Date: 2016-06-15 22:55:03
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 [off-list ref] 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='you@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
From: Johannes Sixt <hidden> Date: 2016-06-15 22:55:03
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.XXXXXX/src/rap/.git
GIT_INDEX_FILE=/home/tester/.ilya/builds/makepkg.rap_0.1-1_sparc.XXXXXX/src/rap/.git-rewrite/t/../index
GIT_WORK_TREE=.
GIT_AUTHOR_NAME=
GIT_COMMITTER_NAME=
GIT_COMMIT=214efc6eec82b015aefe23b2280979f05b351396
fatal: empty ident [off-list ref] 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='j6t@kdbg.org'
GIT_AUTHOR_DATE='@1350025129 +0200'
-- Hannes
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 /
--
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
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.
From: Jeff King <hidden> Date: 2016-06-15 22:55:03
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?
From: Jeff King <hidden> Date: 2016-06-15 22:55:03
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
From: Johannes Sixt <hidden> Date: 2016-06-15 22:55:03
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
From: Jeff King <hidden> Date: 2016-06-15 22:55:03
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