@matheusbsbs / matheus-bagliano / commits / a17171b473
Fork 0

Revert "filter-branch: subdirectory filter needs --full-history"

This reverts commit cfabd6eee1745cfec58cfcb794ce8847e43b888a. I had implemented it without understanding what --full-history does. Consider this history: C--M--N / / / A--B / \ / D-/ where B and C modify a path, X, in the same way so that the result is identical, and D does not modify it at all. With the path limiter X and without --full-history this is simplified to A--B i.e. only one of the paths via B or C is chosen. I had assumed that --full-history would keep both paths like this C--M / / A--B removing the path via D; but in fact it keeps the entire history. Currently, git does not have the capability to simplify to this intermediary case. However, the other extreme to keep the entire history is not wanted either in usual cases. I think we can expect that histories like the above are rare, and in the usual cases we want a simplified history. So let's remove --full-history again. (Concerning t7003, subsequent tests depend on what the test case sets up, so we can't just back out the entire test case.) Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Sixt committed May 26, 2008 at 21:09 UTC a17171b473e0073f73b429abdf348de92394d6a6
2 files changed +3 -12
git-filter-branch.sh
+1 -1
@@ -234,7 +234,7 @@ case "$filter_subdir" in
234 ;;
235 *)
236 git rev-list --reverse --topo-order --default HEAD \
237 - --parents --full-history "$@" -- "$filter_subdir"
237 + --parents "$@" -- "$filter_subdir"
238 esac > ../revs || die "Could not get the commits"
239 commits=$(wc -l <../revs | tr -d " ")
240
t/t7003-filter-branch.sh
+2 -11
@@ -97,7 +97,7 @@ test_expect_success 'subdirectory filter result looks okay' '
97 test_must_fail git show sub:subdir
98 '
99
100 -test_expect_success 'setup and filter history that requires --full-history' '
100 +test_expect_success 'more setup' '
101 git checkout master &&
102 mkdir subdir &&
103 echo A > subdir/new &&
@@ -107,16 +107,7 @@ test_expect_success 'setup and filter history that requires --full-history' '
107 git rm a &&
108 test_tick &&
109 git commit -m "again subdir on master" &&
110 - git merge branch &&
111 - git branch sub-master &&
112 - git-filter-branch -f --subdirectory-filter subdir sub-master
113 -'
114 -
115 -test_expect_success 'subdirectory filter result looks okay' '
116 - test 3 = $(git rev-list -1 --parents sub-master | wc -w) &&
117 - git show sub-master^:new &&
118 - git show sub-master^2:new &&
119 - test_must_fail git show sub:subdir
110 + git merge branch
111 '
112
113 test_expect_success 'use index-filter to move into a subdirectory' '