filter-branch: use --simplify-merges
Use rev-list --simplify-merges everywhere. This changes the behaviour of --subdirectory-filter in cases such as O -- A -\ \ \ \- B -- M where A and B bring the same changes to the subdirectory: It now keeps both sides of the merge. Previously, the history would have been simplified to 'O -- A'. Merges of unrelated side histories that never touch the subdirectory are still removed. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Thomas Rast committed
Aug 12, 2008 at 10:45 UTC
f34a9416ab9efa13a53a31cabd9061d583aaba7e
1 file changed
+4
-3
git-filter-branch.sh
+4
-3
@@ -232,11 +232,11 @@ mkdir ../map || die "Could not create map/ directory"
232
case "$filter_subdir" in
233
"")
234
git rev-list --reverse --topo-order --default HEAD \
235
- --parents "$@"
235
+ --parents --simplify-merges "$@"
236
;;
237
*)
238
git rev-list --reverse --topo-order --default HEAD \
239
- --parents "$@" -- "$filter_subdir"
239
+ --parents --simplify-merges "$@" -- "$filter_subdir"
240
esac > ../revs || die "Could not get the commits"
241
commits=$(wc -l <../revs | tr -d " ")
242
@@ -326,7 +326,8 @@ then
326
do
327
sha1=$(git rev-parse "$ref"^0)
328
test -f "$workdir"/../map/$sha1 && continue
329
- ancestor=$(git rev-list -1 $ref -- "$filter_subdir")
329
+ ancestor=$(git rev-list --simplify-merges -1 \
330
+ $ref -- "$filter_subdir")
331
test "$ancestor" && echo $(map $ancestor) >> "$workdir"/../map/$sha1
332
done < "$tempdir"/heads
333
fi