Skip to content

Commit 537af83

Browse files
authored
Only set safe.directory on Cygwin (which needs it)
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.
1 parent 830025b commit 537af83

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

Diff for: .github/workflows/cygwin-test.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
SHELLOPTS: igncr
1313
TMP: "/tmp"
1414
TEMP: "/tmp"
15-
15+
1616
steps:
1717
- name: Force LF line endings
1818
run: git config --global core.autocrlf input
@@ -24,8 +24,8 @@ jobs:
2424
packages: python39 python39-pip python39-virtualenv git
2525
- name: Tell git to trust this repo
2626
shell: bash.exe -eo pipefail -o igncr "{0}"
27-
run: |
28-
/usr/bin/git config --global --add safe.directory $(pwd)
27+
run: |
28+
/usr/bin/git config --global --add safe.directory "$(pwd)"
2929
/usr/bin/git config --global protocol.file.allow always
3030
- name: Install dependencies and prepare tests
3131
shell: bash.exe -eo pipefail -o igncr "{0}"

Diff for: .github/workflows/pythonpackage.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,8 @@ jobs:
5252
set -x
5353
mypy -p git
5454
55-
- name: Tell git to trust this repo
56-
run: |
57-
/usr/bin/git config --global --add safe.directory $(pwd)
55+
- name: Tell git to allow file protocol even for submodules
56+
run: |
5857
/usr/bin/git config --global protocol.file.allow always
5958
6059
- name: Test with pytest

0 commit comments

Comments
 (0)