Thread (22 messages) flat view 22 messages, 7 authors, 2016-06-15

Re: [PATCH] Add git-filter-branch

From: Jonas Fonseca <hidden>
Date: 2016-06-15 22:43:14
Subsystem: the rest · Maintainer: Linus Torvalds

Johannes Schindelin [off-list ref] wrote Sun, Jun 03, 2007:
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help