aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-09-19 14:07:14 -0700
committerJunio C Hamano <gitster@pobox.com>2010-01-03 23:21:32 -0800
commit1ee26571e97c64bccecfd26d1a1c1c631412a1b7 (patch)
tree43d9288921970f36ac079f824857e34291b8d9f3 /t
parent934f930b3144d03cacd16bc5117ef2afe3b1d04d (diff)
downloadgit-1ee26571e97c64bccecfd26d1a1c1c631412a1b7.tar.gz
git-1ee26571e97c64bccecfd26d1a1c1c631412a1b7.tar.xz
traverse_trees(): handle D/F conflict case sanely
traverse_trees() is supposed to call its callback with all the matching entries from the given trees. The current algorithm keeps a pointer to each of the tree being traversed, and feeds the entry with the earliest name to the callback. This breaks down if the trees being traversed looks like this: A B t-1 t t-2 u t/a v When we are currently looking at an entry "t-1" in tree A, and tree B has returned "t", feeding "t" from the B and not feeding anything from A, only because "t-1" sorts later than "t", will miss an entry for a subtree "t" behind the current entry in tree A. This introduces extended_entry_extract() helper function that gives what name is expected from the tree, and implements a mechanism to look-ahead in the tree object using it, to make sure such a case is handled sanely. Traversal in tree A in the above example will first return "t" to match that of B, and then the next request for an entry to A then returns "t-1". This roughly corresponds to what Linus's "prepare for one-entry lookahead" wanted to do, but because this does implement look ahead, t6035 and one more test in t1012 reveal that the approach would not work without adjusting the side that walks the index in unpack_trees() as well. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t1012-read-tree-df.sh4
-rwxr-xr-xt/t6035-merge-dir-to-symlink.sh2
2 files changed, 3 insertions, 3 deletions
diff --git a/t/t1012-read-tree-df.sh b/t/t1012-read-tree-df.sh
index a961e2ae3..f1e650ac3 100755
--- a/t/t1012-read-tree-df.sh
+++ b/t/t1012-read-tree-df.sh
@@ -76,7 +76,7 @@ test_expect_failure '3-way (2)' '
EOF
'
-test_expect_success '3-way (3)' '
+test_expect_failure '3-way (3)' '
settree A-010 &&
git read-tree -m -u O-010 A-010 B-010 &&
checkindex <<-EOF
@@ -90,7 +90,7 @@ test_expect_success '3-way (3)' '
EOF
'
-test_expect_success '2-way (1)' '
+test_expect_failure '2-way (1)' '
settree O-020 &&
git read-tree -m -u O-020 A-020 &&
checkindex <<-EOF
diff --git a/t/t6035-merge-dir-to-symlink.sh b/t/t6035-merge-dir-to-symlink.sh
index 5b96fb0b3..b9a280e35 100755
--- a/t/t6035-merge-dir-to-symlink.sh
+++ b/t/t6035-merge-dir-to-symlink.sh
@@ -48,7 +48,7 @@ test_expect_success 'setup for merge test' '
git tag baseline
'
-test_expect_success 'do not lose a/b-2/c/d in merge (resolve)' '
+test_expect_failure 'do not lose a/b-2/c/d in merge (resolve)' '
git reset --hard &&
git checkout baseline^0 &&
git merge -s resolve master &&