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:
parent
9d01ae9f20
commit
e9df0f9c7a
@ -148,3 +148,16 @@ client_view() {
|
|||||||
printf "\t%s\n" "$@"
|
printf "\t%s\n" "$@"
|
||||||
) | p4 client -i
|
) | 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
|
||||||
|
}
|
||||||
|
@ -17,6 +17,16 @@ test_expect_success 'init depot' '
|
|||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_failure 'is_cli_file_writeable function' '
|
||||||
|
(
|
||||||
|
cd "$cli" &&
|
||||||
|
echo a >a &&
|
||||||
|
is_cli_file_writeable a &&
|
||||||
|
! is_cli_file_writeable file1 &&
|
||||||
|
rm a
|
||||||
|
)
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'submit with no client dir' '
|
test_expect_success 'submit with no client dir' '
|
||||||
test_when_finished cleanup_git &&
|
test_when_finished cleanup_git &&
|
||||||
git p4 clone --dest="$git" //depot &&
|
git p4 clone --dest="$git" //depot &&
|
||||||
@ -200,7 +210,7 @@ test_expect_success 'submit copy' '
|
|||||||
(
|
(
|
||||||
cd "$cli" &&
|
cd "$cli" &&
|
||||||
test_path_is_file file5.ta &&
|
test_path_is_file file5.ta &&
|
||||||
test ! -w file5.ta
|
! is_cli_file_writeable file5.ta
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
@ -219,7 +229,7 @@ test_expect_success 'submit rename' '
|
|||||||
cd "$cli" &&
|
cd "$cli" &&
|
||||||
test_path_is_missing file6.t &&
|
test_path_is_missing file6.t &&
|
||||||
test_path_is_file file6.ta &&
|
test_path_is_file file6.ta &&
|
||||||
test ! -w file6.ta
|
! is_cli_file_writeable file6.ta
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ test_expect_success 'subdir clone, submit copy' '
|
|||||||
(
|
(
|
||||||
cd "$cli" &&
|
cd "$cli" &&
|
||||||
test_path_is_file dir1/file11a &&
|
test_path_is_file dir1/file11a &&
|
||||||
test ! -w dir1/file11a
|
! is_cli_file_writeable dir1/file11a
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
@ -353,7 +353,7 @@ test_expect_success 'subdir clone, submit rename' '
|
|||||||
cd "$cli" &&
|
cd "$cli" &&
|
||||||
test_path_is_missing dir1/file13 &&
|
test_path_is_missing dir1/file13 &&
|
||||||
test_path_is_file dir1/file13a &&
|
test_path_is_file dir1/file13a &&
|
||||||
test ! -w dir1/file13a
|
! is_cli_file_writeable dir1/file13a
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user