Merge branch 'js/mingw-is-hidden-test-fix'
A Windows-specific test element has been made more robust against misuse from both user's environment and programmer's errors. * js/mingw-is-hidden-test-fix: t: restrict `is_hidden` to be called only on Windows mingw: make test_path_is_hidden more robust t: consolidate the `is_hidden` functions
This commit is contained in:
commit
8b39dfdf47
@ -392,13 +392,6 @@ test_expect_success SYMLINKS 're-init to move gitdir symlink' '
|
|||||||
test_path_is_dir realgitdir/refs
|
test_path_is_dir realgitdir/refs
|
||||||
'
|
'
|
||||||
|
|
||||||
# Tests for the hidden file attribute on windows
|
|
||||||
is_hidden () {
|
|
||||||
# Use the output of `attrib`, ignore the absolute path
|
|
||||||
case "$(attrib "$1")" in *H*?:*) return 0;; esac
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
test_expect_success MINGW '.git hidden' '
|
test_expect_success MINGW '.git hidden' '
|
||||||
rm -rf newdir &&
|
rm -rf newdir &&
|
||||||
(
|
(
|
||||||
@ -406,7 +399,7 @@ test_expect_success MINGW '.git hidden' '
|
|||||||
mkdir newdir &&
|
mkdir newdir &&
|
||||||
cd newdir &&
|
cd newdir &&
|
||||||
git init &&
|
git init &&
|
||||||
is_hidden .git
|
test_path_is_hidden .git
|
||||||
) &&
|
) &&
|
||||||
check_config newdir/.git false unset
|
check_config newdir/.git false unset
|
||||||
'
|
'
|
||||||
|
@ -92,24 +92,17 @@ test_expect_success 'clone -c remote.<remote>.fetch=<refspec> --origin=<name>' '
|
|||||||
test_cmp expect actual
|
test_cmp expect actual
|
||||||
'
|
'
|
||||||
|
|
||||||
# Tests for the hidden file attribute on windows
|
|
||||||
is_hidden () {
|
|
||||||
# Use the output of `attrib`, ignore the absolute path
|
|
||||||
case "$(attrib "$1")" in *H*?:*) return 0;; esac
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
test_expect_success MINGW 'clone -c core.hideDotFiles' '
|
test_expect_success MINGW 'clone -c core.hideDotFiles' '
|
||||||
test_commit attributes .gitattributes "" &&
|
test_commit attributes .gitattributes "" &&
|
||||||
rm -rf child &&
|
rm -rf child &&
|
||||||
git clone -c core.hideDotFiles=false . child &&
|
git clone -c core.hideDotFiles=false . child &&
|
||||||
! is_hidden child/.gitattributes &&
|
! test_path_is_hidden child/.gitattributes &&
|
||||||
rm -rf child &&
|
rm -rf child &&
|
||||||
git clone -c core.hideDotFiles=dotGitOnly . child &&
|
git clone -c core.hideDotFiles=dotGitOnly . child &&
|
||||||
! is_hidden child/.gitattributes &&
|
! test_path_is_hidden child/.gitattributes &&
|
||||||
rm -rf child &&
|
rm -rf child &&
|
||||||
git clone -c core.hideDotFiles=true . child &&
|
git clone -c core.hideDotFiles=true . child &&
|
||||||
is_hidden child/.gitattributes
|
test_path_is_hidden child/.gitattributes
|
||||||
'
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
@ -1551,3 +1551,13 @@ test_bitmap_traversal () {
|
|||||||
test_cmp "$1.normalized" "$2.normalized" &&
|
test_cmp "$1.normalized" "$2.normalized" &&
|
||||||
rm -f "$1.normalized" "$2.normalized"
|
rm -f "$1.normalized" "$2.normalized"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Tests for the hidden file attribute on Windows
|
||||||
|
test_path_is_hidden () {
|
||||||
|
test_have_prereq MINGW ||
|
||||||
|
BUG "test_path_is_hidden can only be used on Windows"
|
||||||
|
|
||||||
|
# Use the output of `attrib`, ignore the absolute path
|
||||||
|
case "$("$SYSTEMROOT"/system32/attrib "$1")" in *H*?:*) return 0;; esac
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user