git-review/git_review/tests
Jeremy Stanley 4fddad6558 Don't make hook script read-only
When a hook script is not executable, Git will ignore its presence
in the hooks dir. To work around that, git-review checks the
downloaded commit-message hook to see whether it's executable and
then adjusts its permissions accordingly. This behavior has been
included since the initial release, but its naive implementation
wiped all existing permissions and then added only read and execute
for the file's owner (0o500/r-x------), leaving it set read-only.
This is overly-restrictive and can lead to minor annoyances when
deleting directories or for atypical multi-user and group ownership
scenarios due to ignoring the umask set for the process.

It is expected that, at this time, the described behavior is not
widely observed outside workflows which rely on fetching the hook
script over HTTP, as the SCP protocol preserves filesystem
permission flags from the source system, but it will have a much
broader impact in the future if git-review's default workflow shifts
away from SCP.

Replace the naive chmod implementation with one which adds execute
for anyone who already has read permission, but does not remove any
existing permissions, for example:

    0o644/rw-r--r-- .. 0o755/rwx-r-xr-x
    0o640/rw-r----- .. 0o750/rwx-r-x---

This new behavior should be more intuitive and less surprising for
users.

Change-Id: I48ac230df09bc802610cfef65bd9818c5b01673d
2024-03-04 23:14:11 +00:00
..
__init__.py Test old and new Gerrit 2023-03-14 08:08:22 -07:00
check_test_id_hashes.py trivial: Update to hacking 2.x 2020-01-16 15:12:58 +00:00
prepare.py trivial: Update to hacking 2.x 2020-01-16 15:12:58 +00:00
test_git_review.py Don't make hook script read-only 2024-03-04 23:14:11 +00:00
test_unit.py Uncap test requirements 2023-09-20 15:05:25 +00:00
utils.py Fix flake8 issue 2024-01-29 09:09:47 -08:00