summaryrefslogtreecommitdiff
path: root/t/lib-git-p4.sh
diff options
context:
space:
mode:
authorPete Wyckoff <pw@padd.com>2013-01-27 03:11:17 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-01-27 06:00:39 (GMT)
commite9df0f9c7a7fbaed924273d0a9b502171ed23b7c (patch)
treeefc692207e049a3ddfc3403c3ab190127563a6a1 /t/lib-git-p4.sh
parent9d01ae9f20435b90619c909e9cbb9ca29f7de494 (diff)
downloadgit-e9df0f9c7a7fbaed924273d0a9b502171ed23b7c.zip
git-e9df0f9c7a7fbaed924273d0a9b502171ed23b7c.tar.gz
git-e9df0f9c7a7fbaed924273d0a9b502171ed23b7c.tar.bz2
git p4: cygwin p4 client does not mark read-only
There are some old versions of p4, compiled for cygwin, that treat read-only files differently. Normally, a file that is not open is read-only, meaning that "test -w" on the file is false. This works on unix, and it works on windows using the NT version of p4. The cygwin version of p4, though, changes the permissions, but does not set the windows read-only attribute, so "test -w" returns false. Notice this oddity and make the tests work, even on cygiwn. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/lib-git-p4.sh')
-rw-r--r--t/lib-git-p4.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/t/lib-git-p4.sh b/t/lib-git-p4.sh
index 67101b1..2098b9b 100644
--- a/t/lib-git-p4.sh
+++ b/t/lib-git-p4.sh
@@ -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
+}