Merge branch 'jk/utf-8-can-be-spelled-differently'
[gitweb.git] / t / lib-git-p4.sh
index 67101b104caf16cdce83e4aa682b759ab3a2d04e..2098b9ba053b09b00ed4382aa55ea0802d749d89 100644 (file)
@@ -148,3 +148,16 @@ client_view() {
                printf "\t%s\n" "$@"
        ) | p4 client -i
 }
+
+is_cli_file_writeable() {
+       # cygwin version of p4 does not set read-only attr,
+       # will be marked 444 but -w is true
+       file="$1" &&
+       if test_have_prereq CYGWIN && p4 -V | grep -q CYGWIN
+       then
+               stat=$(stat --format=%a "$file") &&
+               test $stat = 644
+       else
+               test -w "$file"
+       fi
+}