Skip to content

Instantly share code, notes, and snippets.

@rudyrigot
Created November 22, 2022 16:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rudyrigot/b31fcb6384e829ca7586818758e48d0b to your computer and use it in GitHub Desktop.
Save rudyrigot/b31fcb6384e829ca7586818758e48d0b to your computer and use it in GitHub Desktop.
Attempt to move the new test to an existing test script
diff --git a/t/t7508-status.sh b/t/t7508-status.sh
index 2b7ef6c41a..c980907dc7 100755
--- a/t/t7508-status.sh
+++ b/t/t7508-status.sh
@@ -5,6 +5,9 @@
test_description='git status'
+GIT_TEST_UF_DELAY_WARNING=1
+export GIT_TEST_UF_DELAY_WARNING
+
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-terminal.sh
@@ -1676,4 +1679,86 @@ test_expect_success 'racy timestamps will be fixed for dirty worktree' '
! test_is_magic_mtime .git/index
'
+test_expect_success 'when core.untrackedCache and fsmonitor are unset' '
+ git clean -fd &&
+ git checkout -- . &&
+ git checkout -b statusuoption1 &&
+ git config --global advice.statusuoption true &&
+ test_unconfig core.untrackedCache &&
+ test_unconfig core.fsmonitor &&
+ cat >.gitignore <<-\EOF &&
+ /actual
+ /expect*
+ /out*
+ EOF
+ git add .gitignore .gitconfig &&
+ git commit -m "Add .gitignore" &&
+ git status >out &&
+ sed "s/[0-9]\.[0-9][0-9]/X/g" out >actual &&
+ cat >expected <<-\EOF &&
+ On branch statusuoption1
+
+ It took X seconds to enumerate untracked files.
+ See '"'"'git help status'"'"' for information on how to improve this.
+
+ nothing to commit, working tree clean
+ EOF
+ test_cmp expected actual
+'
+
+test_expect_success 'when core.untrackedCache true, but not fsmonitor' '
+ git clean -fd &&
+ git checkout -- . &&
+ git checkout -b statusuoption2 &&
+ git config --global advice.statusuoption true &&
+ test_config core.untrackedCache true &&
+ test_unconfig core.fsmonitor &&
+ cat >.gitignore <<-\EOF &&
+ /actual
+ /expect*
+ /out*
+ EOF
+ git add .gitignore .gitconfig &&
+ git commit -m "Add .gitignore" &&
+ git status >out &&
+ sed "s/[0-9]\.[0-9][0-9]/X/g" out >actual &&
+ cat >expected <<-\EOF &&
+ On branch statusuoption2
+
+ It took X seconds to enumerate untracked files.
+ See '"'"'git help status'"'"' for information on how to improve this.
+
+ nothing to commit, working tree clean
+ EOF
+ test_cmp expected actual
+'
+
+test_expect_success 'when core.untrackedCache true, and fsmonitor' '
+ git clean -fd &&
+ git checkout -- . &&
+ git checkout -b statusuoption3 &&
+ git config --global advice.statusuoption true &&
+ test_config core.untrackedCache true &&
+ test_config core.fsmonitor true &&
+ cat >.gitignore <<-\EOF &&
+ /actual
+ /expect*
+ /out*
+ EOF
+ git add .gitignore .gitconfig &&
+ git commit -m "Add .gitignore" &&
+ git status >out &&
+ sed "s/[0-9]\.[0-9][0-9]/X/g" out >actual &&
+ cat >expected <<-\EOF &&
+ On branch statusuoption3
+
+ It took X seconds to enumerate untracked files,
+ but the results were cached, and subsequent runs may be faster.
+ See '"'"'git help status'"'"' for information on how to improve this.
+
+ nothing to commit, working tree clean
+ EOF
+ test_cmp expected actual
+'
+
test_done
[...]
expecting success of 7508.118 'when core.untrackedCache true, but not fsmonitor':
git clean -fd &&
git checkout -- . &&
git checkout -b statusuoption2 &&
git config --global advice.statusuoption true &&
test_config core.untrackedCache true &&
test_unconfig core.fsmonitor &&
cat >.gitignore <<-\EOF &&
/actual
/expect*
/out*
EOF
git add .gitignore .gitconfig &&
git commit -m "Add .gitignore" &&
git status >out &&
sed "s/[0-9]\.[0-9][0-9]/X/g" out >actual &&
cat >expected <<-\EOF &&
On branch statusuoption2
It took X seconds to enumerate untracked files.
See 'git help status' for information on how to improve this.
nothing to commit, working tree clean
EOF
test_cmp expected actual
Switched to a new branch 'statusuoption2'
On branch statusuoption2
It took 0.00 seconds to enumerate untracked files.
See 'git help status' for information on how to improve this.
nothing to commit, working tree clean
not ok 118 - when core.untrackedCache true, but not fsmonitor
#
# git clean -fd &&
# git checkout -- . &&
# git checkout -b statusuoption2 &&
# git config --global advice.statusuoption true &&
# test_config core.untrackedCache true &&
# test_unconfig core.fsmonitor &&
# cat >.gitignore <<-\EOF &&
# /actual
# /expect*
# /out*
# EOF
# git add .gitignore .gitconfig &&
# git commit -m "Add .gitignore" &&
# git status >out &&
# sed "s/[0-9]\.[0-9][0-9]/X/g" out >actual &&
# cat >expected <<-\EOF &&
# On branch statusuoption2
#
# It took X seconds to enumerate untracked files.
# See 'git help status' for information on how to improve this.
#
# nothing to commit, working tree clean
# EOF
# test_cmp expected actual
#
expecting success of 7508.119 'when core.untrackedCache true, and fsmonitor':
git clean -fd &&
git checkout -- . &&
git checkout -b statusuoption3 &&
git config --global advice.statusuoption true &&
test_config core.untrackedCache true &&
test_config core.fsmonitor true &&
cat >.gitignore <<-\EOF &&
/actual
/expect*
/out*
EOF
git add .gitignore .gitconfig &&
git commit -m "Add .gitignore" &&
git status >out &&
sed "s/[0-9]\.[0-9][0-9]/X/g" out >actual &&
cat >expected <<-\EOF &&
On branch statusuoption3
It took X seconds to enumerate untracked files,
but the results were cached, and subsequent runs may be faster.
See 'git help status' for information on how to improve this.
nothing to commit, working tree clean
EOF
test_cmp expected actual
Switched to a new branch 'statusuoption3'
On branch statusuoption3
It took 0.00 seconds to enumerate untracked files,
but the results were cached, and subsequent runs may be faster.
See 'git help status' for information on how to improve this.
nothing to commit, working tree clean
not ok 119 - when core.untrackedCache true, and fsmonitor
#
# git clean -fd &&
# git checkout -- . &&
# git checkout -b statusuoption3 &&
# git config --global advice.statusuoption true &&
# test_config core.untrackedCache true &&
# test_config core.fsmonitor true &&
# cat >.gitignore <<-\EOF &&
# /actual
# /expect*
# /out*
# EOF
# git add .gitignore .gitconfig &&
# git commit -m "Add .gitignore" &&
# git status >out &&
# sed "s/[0-9]\.[0-9][0-9]/X/g" out >actual &&
# cat >expected <<-\EOF &&
# On branch statusuoption3
#
# It took X seconds to enumerate untracked files,
# but the results were cached, and subsequent runs may be faster.
# See 'git help status' for information on how to improve this.
#
# nothing to commit, working tree clean
# EOF
# test_cmp expected actual
#
# failed 2 among 119 test(s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment