Re: [PATCH] filter-branch: rewrite only refs which were not excludedbythe options
From: Johannes Sixt <hidden>
Date: 2016-06-15 22:43:23
Johannes Schindelin wrote:
On Tue, 24 Jul 2007, Johannes Sixt wrote:quoted
This worked: negatives=`git rev-parse --revs-only "$@" | while read line do case "$line" in $_x40) ;; *) echo "$line";; esac done` i.e. the closing parenthesis in the case arms together with the opening $( made for a syntax error. The --revs-only did not hurt in my tests, but you may have other reasons to remove it.Funny. AFAIR something similar worked here, all the time. But I believe you... you're on MinGW, right?
No. filter-branch is a shell script. I don't have time to waste ;) It happens in bash 2.05b on Linux.
quoted
But there's another problem. Consider this history: ---X--o--M <- master \ ...-o-...-o <- topic Then this (rather contrieved) command: $ git-filter-branch -n $n master topic --not X If $n is small enough so that M is never rewritten, then git rev-list -1 "$ref" $negatives still expands to non-empty even for 'master' (= M), which then incorrectly ends up in "$tempdir"/heads.Aaargh! Of course! Since I have to add --topo-order at the end. Otherwise it makes no sense.
No, that was no my point: In my example above, if n=1, `git rev-list -1
"$ref" $negatives` evaluates to
$ git rev-list -1 "master" -n 1 ^X
which returns M, even though M is not going to be rewritten.
--topo-order changes nothing. The problem is that the -n is a relative
restriction. --since is turned into --max-age, which is absolute,
therefore, the test works as expected with --since.
quoted
I think the decision whether a positive ref should be rewritten should be postponed until the rewrite has completed. Because then we know for certain which revs were treated and can pick the matching refs. We only lose the check for the error "Which ref do you want to rewrite?"No, that is not enough: A - B - C B touches the subdirectory sub/. git filter-branch C -- sub/ will not rewrite C.
Fair enough. -- Hannes