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
Jeff King <peff@peff.net>
Date
Oct 18, 2012, 10:22 UTC
Message-ID
<20121018102217.GA17332@sigill.intra.peff.net>
In-Reply-To
<20121018075429.GD9999@sigill.intra.peff.net>
On Thu, Oct 18, 2012 at 03:54:29AM -0400, Jeff King wrote:
Show 13 quoted lines
> On Thu, Oct 18, 2012 at 09:49:04AM +0200, Johannes Sixt wrote:
> 
> > > -			s/.*/GIT_'$uid'_NAME='\''&'\''; export GIT_'$uid'_NAME/p
> > 
> > Didn't you lose the export GIT_$uid_{NAME,EMAIL,DATE} parts somewhere on
> > the way?
> 
> Yikes, you're right. I didn't even notice, as the test suite still
> passes. I can see how the env filter would still be able to see the
> variables, but the commit-tree call wouldn't. I guess it happens to work
> because we do not test alternate idents in our filter branch tests (IOW,
> we are silently rewriting each commit during the filter-branch, but it
> happens to have the same identities).

Hrm. We _do_ test this in t7003. Weirder, if I instrument filter-branch like this:

diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 69406ae..1b504ce 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -298,8 +298,13 @@ while read commit parents; do
 	git cat-file commit "$commit" >../commit ||
 		die "Cannot read commit $commit"
 
+	echo >&2 pre: $GIT_AUTHOR_NAME
+	sh -c 'echo >&2 pre, subshell: $GIT_AUTHOR_NAME'
+
 	eval "$(set_ident <../commit)" ||
 		die "setting author/committer failed for commit $commit"
+	echo >&2 post: $GIT_AUTHOR_NAME
+	sh -c 'echo >&2 post, subshell: $GIT_AUTHOR_NAME'
 	eval "$filter_env" < /dev/null ||
 		die "env filter failed: $filter_env"
 
diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh
index 4d13e10..ce57fc5 100755
--- a/t/t7003-filter-branch.sh
+++ b/t/t7003-filter-branch.sh
@@ -174,6 +174,8 @@ test_expect_success 'author information is preserved' '
 	test 1 = $(git rev-list --author="B V Uips" preserved-author | wc -l)
 '
 
+test_done
+
 test_expect_success "remove a certain author's commits" '
 	echo i > i &&
 	test_tick &&

and run t7003, it shows that the variable is properly exported to the
sub-process! But I can't seem to figure out why. Confused...

-Peff
Previous: Jeff KingNext: Jeff King
Message 22 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.