Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Rast <trast@student.ethz.ch>2008-08-12 12:45:58 +0400
committerJunio C Hamano <gitster@pobox.com>2008-08-13 04:27:17 +0400
commita0e46390d397e71182e42930b98b6b59a1a84898 (patch)
tree9c38ceb70da87ef412ea2ce5eca887549f482a90 /t/t7003-filter-branch.sh
parent6e84b712373d343ea3531740d8eb048e84240a39 (diff)
filter-branch: fix ref rewriting with --subdirectory-filter
The previous ancestor discovery code failed on any refs that are (pre-rewrite) ancestors of commits marked for rewriting. This means that in a situation A -- B(topic) -- C(master) where B is dropped by --subdirectory-filter pruning, the 'topic' was not moved up to A as intended, but left unrewritten because we asked about 'git rev-list ^master topic', which does not return anything. Instead, we use the straightforward git rev-list -1 $ref -- $filter_subdir to find the right ancestor. To justify this, note that the nearest ancestor is unique: We use the output of git rev-list --parents -- $filter_subdir to rewrite commits in the first pass, before any ref rewriting. If B is a non-merge commit, the only candidate is its parent. If it is a merge, there are two cases: - All sides of the merge bring the same subdirectory contents. Then rev-list already pruned away the merge in favour for just one of its parents, so there is only one candidate. - Some merge sides, or the merge outcome, differ. Then the merge is not pruned and can be rewritten directly. So it is always safe to use rev-list -1. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7003-filter-branch.sh')
-rwxr-xr-xt/t7003-filter-branch.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh
index 4382baa27d..233254f2b5 100755
--- a/t/t7003-filter-branch.sh
+++ b/t/t7003-filter-branch.sh
@@ -101,7 +101,7 @@ test_expect_success 'filter subdirectory only' '
refs/heads/sub refs/heads/sub-earlier
'
-test_expect_failure 'subdirectory filter result looks okay' '
+test_expect_success 'subdirectory filter result looks okay' '
test 2 = $(git rev-list sub | wc -l) &&
git show sub:new &&
test_must_fail git show sub:subdir &&