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>
This commit is contained in:

committed by
Junio C Hamano

parent
9d01ae9f20
commit
e9df0f9c7a
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user