Skip to content

Commit a17171b

Browse files
Johannes Sixtgitster
authored andcommitted
Revert "filter-branch: subdirectory filter needs --full-history"
This reverts commit cfabd6e. 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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 049c1ad commit a17171b

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

git-filter-branch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ case "$filter_subdir" in
234234
;;
235235
*)
236236
git rev-list --reverse --topo-order --default HEAD \
237-
--parents --full-history "$@" -- "$filter_subdir"
237+
--parents "$@" -- "$filter_subdir"
238238
esac > ../revs || die "Could not get the commits"
239239
commits=$(wc -l <../revs | tr -d " ")
240240

t/t7003-filter-branch.sh

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ test_expect_success 'subdirectory filter result looks okay' '
9797
test_must_fail git show sub:subdir
9898
'
9999

100-
test_expect_success 'setup and filter history that requires --full-history' '
100+
test_expect_success 'more setup' '
101101
git checkout master &&
102102
mkdir subdir &&
103103
echo A > subdir/new &&
@@ -107,16 +107,7 @@ test_expect_success 'setup and filter history that requires --full-history' '
107107
git rm a &&
108108
test_tick &&
109109
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
120111
'
121112

122113
test_expect_success 'use index-filter to move into a subdirectory' '

0 commit comments

Comments
 (0)