summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2022-03-17 09:57:43 (GMT)
committerJohannes Schindelin <johannes.schindelin@gmx.de>2022-03-23 23:31:32 (GMT)
commit303b876f76c2caccc9a289c4f14a2b2d3850684e (patch)
tree1a7e38217fac02c6f9251b78e1cb4d74101f76c7 /t
parent898225ba0419f3a2fabdf11750a90031a838f3b3 (diff)
parent9bcd7a8ecac1c9196bc927647bd06c38ec1feabe (diff)
downloadgit-303b876f76c2caccc9a289c4f14a2b2d3850684e.zip
git-303b876f76c2caccc9a289c4f14a2b2d3850684e.tar.gz
git-303b876f76c2caccc9a289c4f14a2b2d3850684e.tar.bz2
Sync with 2.32.1
* maint-2.32: Git 2.32.1 Git 2.31.2 Git 2.30.3 setup_git_directory(): add an owner check for the top-level directory Add a function to determine whether a path is owned by the current user
Diffstat (limited to 't')
-rwxr-xr-xt/t0060-path-utils.sh20
1 files changed, 14 insertions, 6 deletions
diff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh
index de49607..9e2219f 100755
--- a/t/t0060-path-utils.sh
+++ b/t/t0060-path-utils.sh
@@ -55,12 +55,15 @@ fi
ancestor() {
# We do some math with the expected ancestor length.
expected=$3
- if test -n "$rootoff" && test "x$expected" != x-1; then
- expected=$(($expected-$rootslash))
- test $expected -lt 0 ||
- expected=$(($expected+$rootoff))
- fi
- test_expect_success "longest ancestor: $1 $2 => $expected" \
+ case "$rootoff,$expected,$2" in
+ *,*,//*) ;; # leave UNC paths alone
+ [0-9]*,[0-9]*,/*)
+ # On Windows, expect MSYS2 pseudo root translation for
+ # Unix-style absolute paths
+ expected=$(($expected-$rootslash+$rootoff))
+ ;;
+ esac
+ test_expect_success $4 "longest ancestor: $1 $2 => $expected" \
"actual=\$(test-tool path-utils longest_ancestor_length '$1' '$2') &&
test \"\$actual\" = '$expected'"
}
@@ -156,6 +159,11 @@ ancestor /foo/bar /foo 4
ancestor /foo/bar /foo:/bar 4
ancestor /foo/bar /bar -1
+# Windows-specific: DOS drives, network shares
+ancestor C:/Users/me C:/ 2 MINGW
+ancestor D:/Users/me C:/ -1 MINGW
+ancestor //server/share/my-directory //server/share/ 14 MINGW
+
test_expect_success 'strip_path_suffix' '
test c:/msysgit = $(test-tool path-utils strip_path_suffix \
c:/msysgit/libexec//git-core libexec/git-core)