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

Re: [PATCH] Add git-filter-branch

From
Jonas Fonseca <fonseca@diku.dk>
Date
Jun 5, 2007, 10:18 UTC
Message-ID
<20070605101845.GA16160@diku.dk>
In-Reply-To
<Pine.LNX.4.64.0706030147520.4046@racer.site>
Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote Sun, Jun 03, 2007:
Show 9 quoted lines
> Second, it does not even need bash.
> 
> At least that is what I tried to make sure. I replaced the only instance 
> of a bashim I was aware, namely the arrayism of $unchanged. It can be a 
> string just as well, as we are only storing object names in it.
> 
> Tell me if it does not work for you.
> 
> Or even better, provide me with a test case that fails for you.
I found a small problem when /bin/sh is linked to dash.
$ /bin/dash t*-filter-branch.sh
*   ok 1: setup
* FAIL 2: rewrite identically
                git-filter-branch H2
* FAIL 3: result is really identical
                test $H = $(git-rev-parse H2)
* FAIL 4: rewrite, renaming a specific file
                git-filter-branch --tree-filter "mv d doh || :" H3
* FAIL 5: test that the file was renamed
                test d = $(git show H3:doh)
* failed 4 among 5 test(s)
$ cd trash/
$ rm -rf .git-rewrite/
$ git filter-branch H2
/home/fonseca/bin/git-filter-branch: 386: arith: syntax error: "i+1"
$
A possible fix that makes the test pass for me.
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 0c8a7df..5cf9d3c 100644
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -339,7 +339,7 @@ test $commits -eq 0 && die "Found nothing to rewrite"
 
 i=0
 while read commit; do
-	i=$((i+1))
+	i=$(echo i+1 | bc)
 	printf "$commit ($i/$commits) "
 
 	git-read-tree -i -m $commit
-- 
Jonas Fonseca
Previous: Johannes SchindelinNext: David Kastrup
Message 7 of 27 in “Add git-filter-branch”
  1. Add git-filter-branchJohannes Schindelin, Jun 3, 2007
  2. Jakub NarebskiJun 3, 2007
  3. Johannes SchindelinJun 3, 2007
  4. Jakub NarebskiJun 3, 2007
  5. Steven GrimmJun 3, 2007
  6. Johannes SchindelinJun 3, 2007
  7. Jonas FonsecaJun 5, 2007
  8. David KastrupJun 5, 2007
  9. Junio C HamanoJun 5, 2007
  10. Jonas FonsecaJun 5, 2007
  11. Johannes SchindelinJun 5, 2007
  12. filter-branch: use $(($i+1)) instead of $((i+1))Johannes Schindelin, Jun 6, 2007
  13. Johannes SixtJun 4, 2007
  14. Johannes SixtJun 4, 2007
  15. Johannes SchindelinJun 4, 2007
  16. Johannes SixtJun 4, 2007
  17. Johannes SchindelinJun 4, 2007
  18. Johannes SixtJun 5, 2007
  19. Johannes SchindelinJun 5, 2007
  20. Johannes SixtJun 6, 2007
  21. Junio C HamanoJun 6, 2007
  22. Johannes SchindelinJun 6, 2007
  23. Johannes SixtJun 6, 2007
  24. Johannes SchindelinJun 6, 2007
  25. filter-branch: also don't fail in map() if a commit cannot be mappedJohannes Sixt, Jun 6, 2007
  26. Johannes SchindelinJun 6, 2007
  27. filter-branch: also don't fail in map() if a commit cannot be mappedJohannes Sixt, Jun 6, 2007

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.