Re: [PATCH v5 1/2] filter-branch: stop special-casing $filter_subdir argument
From: Thomas Rast <hidden>
Date: 2016-06-15 22:47:42
Johannes Sixt wrote in the other reply:
I thought that the intention to give an extra path argument is to reduce the number of commits that remain in the rewritten history. But by giving --subdirectory-filter, the path filter actually loosened, and many more commits are rewritten.
Right, I had a thinko there, the path filter adds up as an "or", so filtering for paths outside the subdir loosens it (and filtering for more paths inside doesn't make a difference).
Since your intention to write this patch is actually to implement --remap-to-ancestor, I suggest that we defer the question whether the above use-case makes sense, and only rewrite this particular paragraph in the commit message to point out the real bug:
Agreed. Johannes Sixt wrote:
Furthermore, --subdirectory-filter supplies its own '--', and if the user provided one himself, such as in git filter-branch --subdirectory-filter subdir -- --all -- subdir/file an extra '--' was used as path filter in the call to git-rev-list that determines the commits that shall be rewritten.
There's some stray space here that should probably also be removed.
Here it is. The interdiff to your version is merely
[...]
# we need "--" only if there are no path arguments in $@
nonrevs=$(git rev-parse --no-revs "$@") || exit
-dashdash=${nonrevs+"--"}
+test -z "$nonrevs" && dashdash=-- || dashdash=
Ack.
--
Thomas Rast
trast@{inf,student}.ethz.ch