summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6371302)
raw | patch | inline | side by side (parent: 6371302)
author | Junio C Hamano <junkio@cox.net> | |
Fri, 20 May 2005 16:48:38 +0000 (09:48 -0700) | ||
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Fri, 20 May 2005 17:08:56 +0000 (10:08 -0700) |
The same check we added earlier to update-cache to catch ENOTDIR
turns out to be missing from diff-files. This causes a
difference not being reported when you have DF/DF (a file in a
subdirectory) in the cache and DF is a file on the filesystem.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
turns out to be missing from diff-files. This causes a
difference not being reported when you have DF/DF (a file in a
subdirectory) in the cache and DF is a file on the filesystem.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
diff-files.c | patch | blob | history | |
t/t4002-diff-basic.sh | patch | blob | history |
diff --git a/diff-files.c b/diff-files.c
index 414b36ec909fbded2972cbb08ac6c1e307058f23..eb99c3cf097d1628289a988e7c4f858d212ffa88 100644 (file)
--- a/diff-files.c
+++ b/diff-files.c
}
if (lstat(ce->name, &st) < 0) {
- if (errno != ENOENT) {
+ if (errno != ENOENT && errno != ENOTDIR) {
perror(ce->name);
continue;
}
diff --git a/t/t4002-diff-basic.sh b/t/t4002-diff-basic.sh
index 1bfbc2043b3681a820d344aee803599ed318049f..5da05be2c1a0d49b7b405e5a7f5cbf4d0af0790a 100644 (file)
--- a/t/t4002-diff-basic.sh
+++ b/t/t4002-diff-basic.sh
*100644->100644 blob 3fdbe17fd013303a2e981e1ca1c6cd6e72789087->7e09d6a3a14bd630913e8c75693cea32157b606d Z/NM
EOF
+
+x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
+x40="$x40$x40$x40$x40$x40$x40$x40$x40"
+z40='0000000000000000000000000000000000000000'
+cmp_diff_files_output () {
+ # diff-files never reports additions. Also it does not fill in the
+ # object ID for the changed files because it wants you to look at the
+ # filesystem.
+ sed <"$2" >.test-tmp \
+ -e '/^+/d;/\^*/s/\( '$x40'->\)'$x40' /\1'$z40' /' &&
+ diff "$1" .test-tmp
+}
+
test_expect_success \
'diff-tree of known trees.' \
'git-diff-tree $tree_O $tree_A >.test-a &&
'git-diff-tree -r $tree_A $tree_B >.test-a &&
cmp -s .test-a .test-recursive-AB'
+test_expect_success \
+ 'diff-cache O with A in cache' \
+ 'git-read-tree $tree_A &&
+ git-diff-cache --cached $tree_O >.test-a &&
+ cmp -s .test-a .test-recursive-OA'
+
+test_expect_success \
+ 'diff-cache O with B in cache' \
+ 'git-read-tree $tree_B &&
+ git-diff-cache --cached $tree_O >.test-a &&
+ cmp -s .test-a .test-recursive-OB'
+
+test_expect_success \
+ 'diff-cache A with B in cache' \
+ 'git-read-tree $tree_B &&
+ git-diff-cache --cached $tree_A >.test-a &&
+ cmp -s .test-a .test-recursive-AB'
+
+test_expect_success \
+ 'diff-files with O in cache and A checked out' \
+ 'rm -fr Z [A-Z][A-Z] &&
+ git-read-tree $tree_A &&
+ git-checkout-cache -f -a &&
+ git-read-tree -m $tree_O || (exit 1)
+ git-update-cache --refresh >/dev/null ;# this can exit non-zero
+ git-diff-files >.test-a &&
+ cmp_diff_files_output .test-a .test-recursive-OA'
+
+test_expect_success \
+ 'diff-files with O in cache and B checked out' \
+ 'rm -fr Z [A-Z][A-Z] &&
+ git-read-tree $tree_B &&
+ git-checkout-cache -f -a &&
+ git-read-tree -m $tree_O || (exit 1)
+ git-update-cache --refresh >/dev/null ;# this can exit non-zero
+ git-diff-files >.test-a &&
+ cmp_diff_files_output .test-a .test-recursive-OB'
+
+test_expect_success \
+ 'diff-files with A in cache and B checked out' \
+ 'rm -fr Z [A-Z][A-Z] &&
+ git-read-tree $tree_B &&
+ git-checkout-cache -f -a &&
+ git-read-tree -m $tree_A || (exit 1)
+ git-update-cache --refresh >/dev/null ;# this can exit non-zero
+ git-diff-files >.test-a &&
+ cmp_diff_files_output .test-a .test-recursive-AB'
+
################################################################
# Now we have established the baseline, we do not have to
# rely on individual object ID values that much.