t7063: more thorough status checking
It turns out the t7063 has some testcases that even without using the untracked cache cover situations that nothing else in the testsuite handles. Checking the results of git status --porcelain both with and without the untracked cache, and comparing both against our expected results helped uncover a critical bug in some dir.c restructuring. Unfortunately, it's not easy to run status and tell it to ignore the untracked cache; the only knob we have is core.untrackedCache=false, which is used to instruct git to *delete* the untracked cache (which might also ignore the untracked cache when it operates, but that isn't specified in the docs). Create a simple helper that will create a clone of the index that is missing the untracked cache bits, and use it to compare that the results with the untracked cache match the results we get without the untracked cache. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
0822e66b5d
commit
ce5c61a3f5
@ -30,6 +30,30 @@ status_is_clean() {
|
|||||||
test_must_be_empty ../status.actual
|
test_must_be_empty ../status.actual
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Ignore_Untracked_Cache, abbreviated to 3 letters because then people can
|
||||||
|
# compare commands side-by-side, e.g.
|
||||||
|
# iuc status --porcelain >expect &&
|
||||||
|
# git status --porcelain >actual &&
|
||||||
|
# test_cmp expect actual
|
||||||
|
iuc () {
|
||||||
|
git ls-files -s >../current-index-entries
|
||||||
|
git ls-files -t | sed -ne s/^S.//p >../current-sparse-entries
|
||||||
|
|
||||||
|
GIT_INDEX_FILE=.git/tmp_index
|
||||||
|
export GIT_INDEX_FILE
|
||||||
|
git update-index --index-info <../current-index-entries
|
||||||
|
git update-index --skip-worktree $(cat ../current-sparse-entries)
|
||||||
|
|
||||||
|
git -c core.untrackedCache=false "$@"
|
||||||
|
ret=$?
|
||||||
|
|
||||||
|
rm ../current-index-entries
|
||||||
|
rm $GIT_INDEX_FILE
|
||||||
|
unset GIT_INDEX_FILE
|
||||||
|
|
||||||
|
return $ret
|
||||||
|
}
|
||||||
|
|
||||||
test_lazy_prereq UNTRACKED_CACHE '
|
test_lazy_prereq UNTRACKED_CACHE '
|
||||||
{ git update-index --test-untracked-cache; ret=$?; } &&
|
{ git update-index --test-untracked-cache; ret=$?; } &&
|
||||||
test $ret -ne 1
|
test $ret -ne 1
|
||||||
@ -95,6 +119,8 @@ test_expect_success 'status first time (empty cache)' '
|
|||||||
: >../trace &&
|
: >../trace &&
|
||||||
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
|
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
|
||||||
git status --porcelain >../actual &&
|
git status --porcelain >../actual &&
|
||||||
|
iuc status --porcelain >../status.iuc &&
|
||||||
|
test_cmp ../status.expect ../status.iuc &&
|
||||||
test_cmp ../status.expect ../actual &&
|
test_cmp ../status.expect ../actual &&
|
||||||
cat >../trace.expect <<EOF &&
|
cat >../trace.expect <<EOF &&
|
||||||
node creation: 3
|
node creation: 3
|
||||||
@ -115,6 +141,8 @@ test_expect_success 'status second time (fully populated cache)' '
|
|||||||
: >../trace &&
|
: >../trace &&
|
||||||
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
|
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
|
||||||
git status --porcelain >../actual &&
|
git status --porcelain >../actual &&
|
||||||
|
iuc status --porcelain >../status.iuc &&
|
||||||
|
test_cmp ../status.expect ../status.iuc &&
|
||||||
test_cmp ../status.expect ../actual &&
|
test_cmp ../status.expect ../actual &&
|
||||||
cat >../trace.expect <<EOF &&
|
cat >../trace.expect <<EOF &&
|
||||||
node creation: 0
|
node creation: 0
|
||||||
@ -136,6 +164,7 @@ test_expect_success 'modify in root directory, one dir invalidation' '
|
|||||||
: >../trace &&
|
: >../trace &&
|
||||||
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
|
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
|
||||||
git status --porcelain >../actual &&
|
git status --porcelain >../actual &&
|
||||||
|
iuc status --porcelain >../status.iuc &&
|
||||||
cat >../status.expect <<EOF &&
|
cat >../status.expect <<EOF &&
|
||||||
A done/one
|
A done/one
|
||||||
A one
|
A one
|
||||||
@ -145,6 +174,7 @@ A two
|
|||||||
?? four
|
?? four
|
||||||
?? three
|
?? three
|
||||||
EOF
|
EOF
|
||||||
|
test_cmp ../status.expect ../status.iuc &&
|
||||||
test_cmp ../status.expect ../actual &&
|
test_cmp ../status.expect ../actual &&
|
||||||
cat >../trace.expect <<EOF &&
|
cat >../trace.expect <<EOF &&
|
||||||
node creation: 0
|
node creation: 0
|
||||||
@ -183,6 +213,7 @@ test_expect_success 'new .gitignore invalidates recursively' '
|
|||||||
: >../trace &&
|
: >../trace &&
|
||||||
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
|
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
|
||||||
git status --porcelain >../actual &&
|
git status --porcelain >../actual &&
|
||||||
|
iuc status --porcelain >../status.iuc &&
|
||||||
cat >../status.expect <<EOF &&
|
cat >../status.expect <<EOF &&
|
||||||
A done/one
|
A done/one
|
||||||
A one
|
A one
|
||||||
@ -192,6 +223,7 @@ A two
|
|||||||
?? dtwo/
|
?? dtwo/
|
||||||
?? three
|
?? three
|
||||||
EOF
|
EOF
|
||||||
|
test_cmp ../status.expect ../status.iuc &&
|
||||||
test_cmp ../status.expect ../actual &&
|
test_cmp ../status.expect ../actual &&
|
||||||
cat >../trace.expect <<EOF &&
|
cat >../trace.expect <<EOF &&
|
||||||
node creation: 0
|
node creation: 0
|
||||||
@ -230,6 +262,7 @@ test_expect_success 'new info/exclude invalidates everything' '
|
|||||||
: >../trace &&
|
: >../trace &&
|
||||||
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
|
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
|
||||||
git status --porcelain >../actual &&
|
git status --porcelain >../actual &&
|
||||||
|
iuc status --porcelain >../status.iuc &&
|
||||||
cat >../status.expect <<EOF &&
|
cat >../status.expect <<EOF &&
|
||||||
A done/one
|
A done/one
|
||||||
A one
|
A one
|
||||||
@ -237,6 +270,7 @@ A two
|
|||||||
?? .gitignore
|
?? .gitignore
|
||||||
?? dtwo/
|
?? dtwo/
|
||||||
EOF
|
EOF
|
||||||
|
test_cmp ../status.expect ../status.iuc &&
|
||||||
test_cmp ../status.expect ../actual &&
|
test_cmp ../status.expect ../actual &&
|
||||||
cat >../trace.expect <<EOF &&
|
cat >../trace.expect <<EOF &&
|
||||||
node creation: 0
|
node creation: 0
|
||||||
@ -286,6 +320,7 @@ test_expect_success 'status after the move' '
|
|||||||
: >../trace &&
|
: >../trace &&
|
||||||
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
|
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
|
||||||
git status --porcelain >../actual &&
|
git status --porcelain >../actual &&
|
||||||
|
iuc status --porcelain >../status.iuc &&
|
||||||
cat >../status.expect <<EOF &&
|
cat >../status.expect <<EOF &&
|
||||||
A done/one
|
A done/one
|
||||||
A one
|
A one
|
||||||
@ -293,6 +328,7 @@ A one
|
|||||||
?? dtwo/
|
?? dtwo/
|
||||||
?? two
|
?? two
|
||||||
EOF
|
EOF
|
||||||
|
test_cmp ../status.expect ../status.iuc &&
|
||||||
test_cmp ../status.expect ../actual &&
|
test_cmp ../status.expect ../actual &&
|
||||||
cat >../trace.expect <<EOF &&
|
cat >../trace.expect <<EOF &&
|
||||||
node creation: 0
|
node creation: 0
|
||||||
@ -343,6 +379,7 @@ test_expect_success 'status after the move' '
|
|||||||
: >../trace &&
|
: >../trace &&
|
||||||
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
|
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
|
||||||
git status --porcelain >../actual &&
|
git status --porcelain >../actual &&
|
||||||
|
iuc status --porcelain >../status.iuc &&
|
||||||
cat >../status.expect <<EOF &&
|
cat >../status.expect <<EOF &&
|
||||||
A done/one
|
A done/one
|
||||||
A one
|
A one
|
||||||
@ -350,6 +387,7 @@ A two
|
|||||||
?? .gitignore
|
?? .gitignore
|
||||||
?? dtwo/
|
?? dtwo/
|
||||||
EOF
|
EOF
|
||||||
|
test_cmp ../status.expect ../status.iuc &&
|
||||||
test_cmp ../status.expect ../actual &&
|
test_cmp ../status.expect ../actual &&
|
||||||
cat >../trace.expect <<EOF &&
|
cat >../trace.expect <<EOF &&
|
||||||
node creation: 0
|
node creation: 0
|
||||||
@ -390,10 +428,12 @@ test_expect_success 'status after commit' '
|
|||||||
: >../trace &&
|
: >../trace &&
|
||||||
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
|
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
|
||||||
git status --porcelain >../actual &&
|
git status --porcelain >../actual &&
|
||||||
|
iuc status --porcelain >../status.iuc &&
|
||||||
cat >../status.expect <<EOF &&
|
cat >../status.expect <<EOF &&
|
||||||
?? .gitignore
|
?? .gitignore
|
||||||
?? dtwo/
|
?? dtwo/
|
||||||
EOF
|
EOF
|
||||||
|
test_cmp ../status.expect ../status.iuc &&
|
||||||
test_cmp ../status.expect ../actual &&
|
test_cmp ../status.expect ../actual &&
|
||||||
cat >../trace.expect <<EOF &&
|
cat >../trace.expect <<EOF &&
|
||||||
node creation: 0
|
node creation: 0
|
||||||
@ -447,12 +487,14 @@ test_expect_success 'test sparse status with untracked cache' '
|
|||||||
avoid_racy &&
|
avoid_racy &&
|
||||||
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
|
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
|
||||||
git status --porcelain >../status.actual &&
|
git status --porcelain >../status.actual &&
|
||||||
|
iuc status --porcelain >../status.iuc &&
|
||||||
cat >../status.expect <<EOF &&
|
cat >../status.expect <<EOF &&
|
||||||
M done/two
|
M done/two
|
||||||
?? .gitignore
|
?? .gitignore
|
||||||
?? done/five
|
?? done/five
|
||||||
?? dtwo/
|
?? dtwo/
|
||||||
EOF
|
EOF
|
||||||
|
test_cmp ../status.expect ../status.iuc &&
|
||||||
test_cmp ../status.expect ../status.actual &&
|
test_cmp ../status.expect ../status.actual &&
|
||||||
cat >../trace.expect <<EOF &&
|
cat >../trace.expect <<EOF &&
|
||||||
node creation: 0
|
node creation: 0
|
||||||
@ -487,12 +529,14 @@ test_expect_success 'test sparse status again with untracked cache' '
|
|||||||
: >../trace &&
|
: >../trace &&
|
||||||
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
|
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
|
||||||
git status --porcelain >../status.actual &&
|
git status --porcelain >../status.actual &&
|
||||||
|
iuc status --porcelain >../status.iuc &&
|
||||||
cat >../status.expect <<EOF &&
|
cat >../status.expect <<EOF &&
|
||||||
M done/two
|
M done/two
|
||||||
?? .gitignore
|
?? .gitignore
|
||||||
?? done/five
|
?? done/five
|
||||||
?? dtwo/
|
?? dtwo/
|
||||||
EOF
|
EOF
|
||||||
|
test_cmp ../status.expect ../status.iuc &&
|
||||||
test_cmp ../status.expect ../status.actual &&
|
test_cmp ../status.expect ../status.actual &&
|
||||||
cat >../trace.expect <<EOF &&
|
cat >../trace.expect <<EOF &&
|
||||||
node creation: 0
|
node creation: 0
|
||||||
@ -514,6 +558,7 @@ test_expect_success 'test sparse status with untracked cache and subdir' '
|
|||||||
: >../trace &&
|
: >../trace &&
|
||||||
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
|
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
|
||||||
git status --porcelain >../status.actual &&
|
git status --porcelain >../status.actual &&
|
||||||
|
iuc status --porcelain >../status.iuc &&
|
||||||
cat >../status.expect <<EOF &&
|
cat >../status.expect <<EOF &&
|
||||||
M done/two
|
M done/two
|
||||||
?? .gitignore
|
?? .gitignore
|
||||||
@ -521,6 +566,7 @@ test_expect_success 'test sparse status with untracked cache and subdir' '
|
|||||||
?? done/sub/
|
?? done/sub/
|
||||||
?? dtwo/
|
?? dtwo/
|
||||||
EOF
|
EOF
|
||||||
|
test_cmp ../status.expect ../status.iuc &&
|
||||||
test_cmp ../status.expect ../status.actual &&
|
test_cmp ../status.expect ../status.actual &&
|
||||||
cat >../trace.expect <<EOF &&
|
cat >../trace.expect <<EOF &&
|
||||||
node creation: 2
|
node creation: 2
|
||||||
@ -560,6 +606,8 @@ test_expect_success 'test sparse status again with untracked cache and subdir' '
|
|||||||
: >../trace &&
|
: >../trace &&
|
||||||
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
|
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace" \
|
||||||
git status --porcelain >../status.actual &&
|
git status --porcelain >../status.actual &&
|
||||||
|
iuc status --porcelain >../status.iuc &&
|
||||||
|
test_cmp ../status.expect ../status.iuc &&
|
||||||
test_cmp ../status.expect ../status.actual &&
|
test_cmp ../status.expect ../status.actual &&
|
||||||
cat >../trace.expect <<EOF &&
|
cat >../trace.expect <<EOF &&
|
||||||
node creation: 0
|
node creation: 0
|
||||||
@ -573,6 +621,7 @@ EOF
|
|||||||
test_expect_success 'move entry in subdir from untracked to cached' '
|
test_expect_success 'move entry in subdir from untracked to cached' '
|
||||||
git add dtwo/two &&
|
git add dtwo/two &&
|
||||||
git status --porcelain >../status.actual &&
|
git status --porcelain >../status.actual &&
|
||||||
|
iuc status --porcelain >../status.iuc &&
|
||||||
cat >../status.expect <<EOF &&
|
cat >../status.expect <<EOF &&
|
||||||
M done/two
|
M done/two
|
||||||
A dtwo/two
|
A dtwo/two
|
||||||
@ -580,12 +629,14 @@ A dtwo/two
|
|||||||
?? done/five
|
?? done/five
|
||||||
?? done/sub/
|
?? done/sub/
|
||||||
EOF
|
EOF
|
||||||
|
test_cmp ../status.expect ../status.iuc &&
|
||||||
test_cmp ../status.expect ../status.actual
|
test_cmp ../status.expect ../status.actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'move entry in subdir from cached to untracked' '
|
test_expect_success 'move entry in subdir from cached to untracked' '
|
||||||
git rm --cached dtwo/two &&
|
git rm --cached dtwo/two &&
|
||||||
git status --porcelain >../status.actual &&
|
git status --porcelain >../status.actual &&
|
||||||
|
iuc status --porcelain >../status.iuc &&
|
||||||
cat >../status.expect <<EOF &&
|
cat >../status.expect <<EOF &&
|
||||||
M done/two
|
M done/two
|
||||||
?? .gitignore
|
?? .gitignore
|
||||||
@ -593,6 +644,7 @@ test_expect_success 'move entry in subdir from cached to untracked' '
|
|||||||
?? done/sub/
|
?? done/sub/
|
||||||
?? dtwo/
|
?? dtwo/
|
||||||
EOF
|
EOF
|
||||||
|
test_cmp ../status.expect ../status.iuc &&
|
||||||
test_cmp ../status.expect ../status.actual
|
test_cmp ../status.expect ../status.actual
|
||||||
'
|
'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user