Skip to content

Commit

Permalink
Only set safe.directory on Cygwin (which needs it)
Browse files Browse the repository at this point in the history
This stops setting the current directory as an explicit safe
directory on CI for non-Windows systems, where this is not needed
because the repository has the ownership Git expects. The step name
is updated accordingly to reflect its now narrower purpose.

This also adds shell quoting to $(pwd) in the Cygwin workflow. In
practice, on CI, the path is very unlikely to contain whitespace,
but double-quoting $ expansions on which splitting and globbing are
unwanted is more robust and better expresses intent. This also has
the benefit that users who use the CI workflows as a guide to
commands they run locally, where on Windows they may very well have
spaces somewhere in this absolute path, will use a correct command.
  • Loading branch information
EliahKagan authored Sep 6, 2023
1 parent 830025b commit 537af83
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/cygwin-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
SHELLOPTS: igncr
TMP: "/tmp"
TEMP: "/tmp"

steps:
- name: Force LF line endings
run: git config --global core.autocrlf input
Expand All @@ -24,8 +24,8 @@ jobs:
packages: python39 python39-pip python39-virtualenv git
- name: Tell git to trust this repo
shell: bash.exe -eo pipefail -o igncr "{0}"
run: |
/usr/bin/git config --global --add safe.directory $(pwd)
run: |
/usr/bin/git config --global --add safe.directory "$(pwd)"
/usr/bin/git config --global protocol.file.allow always
- name: Install dependencies and prepare tests
shell: bash.exe -eo pipefail -o igncr "{0}"
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ jobs:
set -x
mypy -p git
- name: Tell git to trust this repo
run: |
/usr/bin/git config --global --add safe.directory $(pwd)
- name: Tell git to allow file protocol even for submodules
run: |
/usr/bin/git config --global protocol.file.allow always
- name: Test with pytest
Expand Down

0 comments on commit 537af83

Please sign in to comment.