summaryrefslogtreecommitdiff
path: root/t/t1005-read-tree-m-2way-emu23.sh
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <junkio@cox.net>2005-06-25 02:25:29 -0700
committerLibravatar Linus Torvalds <torvalds@ppc970.osdl.org>2005-06-25 16:52:16 -0700
commitb155725daeec48436d1fcbec4854ffd317408a6e (patch)
tree37c9bb329b890f432e21508bda67ef093cdd8130 /t/t1005-read-tree-m-2way-emu23.sh
parent[PATCH] git-merge-one-file-script: do not misinterpret rm failure. (diff)
downloadtgif-b155725daeec48436d1fcbec4854ffd317408a6e.tar.xz
[PATCH] Fix oversimplified optimization for add_cache_entry().
An earlier change to optimize directory-file conflict check broke what "read-tree --emu23" expects. This is fixed by this commit. (1) Introduces an explicit flag to tell add_cache_entry() not to check for conflicts and use it when reading an existing tree into an empty stage --- by definition this case can never introduce such conflicts. (2) Makes read-cache.c:has_file_name() and read-cache.c:has_dir_name() aware of the cache stages, and flag conflict only with paths in the same stage. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 't/t1005-read-tree-m-2way-emu23.sh')
-rw-r--r--t/t1005-read-tree-m-2way-emu23.sh25
1 files changed, 20 insertions, 5 deletions
diff --git a/t/t1005-read-tree-m-2way-emu23.sh b/t/t1005-read-tree-m-2way-emu23.sh
index a026977cd6..d80752ddd5 100644
--- a/t/t1005-read-tree-m-2way-emu23.sh
+++ b/t/t1005-read-tree-m-2way-emu23.sh
@@ -366,6 +366,7 @@ test_expect_success \
treeDF=`git-write-tree` &&
echo treeDF $treeDF &&
git-ls-tree $treeDF &&
+ git-ls-files --stage >DF.out
rm -f DF &&
mkdir DF &&
@@ -377,7 +378,7 @@ test_expect_success \
git-ls-files --stage >DFDF.out'
test_expect_success \
- 'DF vs DF/DF case test.' \
+ 'DF vs DF/DF case test (#1)' \
'rm -f .git/index &&
rm -fr DF &&
echo DF >DF &&
@@ -388,10 +389,24 @@ test_expect_success \
check_cache_at DF/DF clean && # different from pure 2-way
:'
+# The other way around
+test_expect_success \
+ 'DF vs DF/DF case test (#2)' \
+ 'rm -f .git/index &&
+ rm -fr DF &&
+ mkdir DF &&
+ echo DF/DF >DF/DF &&
+ git-update-cache --add DF/DF &&
+ read_tree_twoway $treeDFDF $treeDF &&
+ git-ls-files --stage >DFDFcheck.out &&
+ diff -u DF.out DFDFcheck.out &&
+ check_cache_at DF clean && # different from pure 2-way
+ :'
+
# Emu23 can grok I having more than H. Make sure we did not
-# botch the conflict tests (Linus code botches this test).
+# botch the conflict tests (fixed).
test_expect_success \
- 'DF vs DF/DF case test (#2).' \
+ 'DF vs DF/DF case test (#3).' \
'rm -f .git/index &&
rm -fr DF &&
mkdir DF &&
@@ -400,8 +415,8 @@ test_expect_success \
# This should fail because I and H have a conflict
# at DF.
if git-read-tree --emu23 $treeDF $treeDFDF
- then true ;# should be false
- else false ;# should be true
+ then false
+ else true
fi'
test_done