Skip to content

Commit

Permalink
filter-branch: use --simplify-merges
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thomas Rast authored and Junio C Hamano committed Aug 13, 2008
1 parent 5b2eeed commit f34a941
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions git-filter-branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,11 @@ mkdir ../map || die "Could not create map/ directory"
case "$filter_subdir" in
"")
git rev-list --reverse --topo-order --default HEAD \
--parents "$@"
--parents --simplify-merges "$@"
;;
*)
git rev-list --reverse --topo-order --default HEAD \
--parents "$@" -- "$filter_subdir"
--parents --simplify-merges "$@" -- "$filter_subdir"
esac > ../revs || die "Could not get the commits"
commits=$(wc -l <../revs | tr -d " ")

Expand Down Expand Up @@ -326,7 +326,8 @@ then
do
sha1=$(git rev-parse "$ref"^0)
test -f "$workdir"/../map/$sha1 && continue
ancestor=$(git rev-list -1 $ref -- "$filter_subdir")
ancestor=$(git rev-list --simplify-merges -1 \
$ref -- "$filter_subdir")
test "$ancestor" && echo $(map $ancestor) >> "$workdir"/../map/$sha1
done < "$tempdir"/heads
fi
Expand Down

0 comments on commit f34a941

Please sign in to comment.