Skip to content

Commit 9a9e4e2

Browse files
EliahKaganclaude
andcommitted
DIAG v5: verify git/ext/gitdb is pre-created by actions/checkout
Tests the placeholder hypothesis: that `git/ext/gitdb` exists with NTFS owner = `BUILTIN\\Administrators` immediately after `actions/checkout`'s `git clone`, before any submodule update has run. If true, this explains the asymmetry: gitdb's worktree directory is materialized as a placeholder for the tracked submodule entry by Windows git, then Cygwin `git submodule update` clones into the existing directory but doesn't change its owner, while smmap's worktree is created entirely by Cygwin git inside Cygwin-created parents. Three checks: post-checkout/pre-update existence and Owner of `git/ext/gitdb`; same via Cygwin `stat`; post-update Owners of all worktree/gitdir paths to confirm the v4 pattern reproduces. This branch should be deleted once the data is captured. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 8f1348d commit 9a9e4e2

1 file changed

Lines changed: 84 additions & 105 deletions

File tree

‎.github/workflows/cygwin-test.yml‎

Lines changed: 84 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -6,131 +6,110 @@ permissions:
66
contents: read
77

88
jobs:
9-
test:
10-
strategy:
11-
matrix:
12-
selection: [fast, perf]
13-
include:
14-
- selection: fast
15-
additional-pytest-args: --ignore=test/performance
16-
- selection: perf
17-
additional-pytest-args: test/performance
18-
19-
fail-fast: false
20-
9+
diag:
2110
runs-on: windows-latest
2211

23-
env: &cygwin-env
12+
env:
2413
CHERE_INVOKING: "1"
2514
CYGWIN_NOWINPATH: "1"
2615

27-
defaults: &cygwin-defaults
16+
defaults:
2817
run:
2918
shell: C:\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr "{0}"
3019

3120
steps:
32-
- &force-lf
33-
name: Force LF line endings
21+
- name: Force LF line endings
3422
run: |
35-
git config --global core.autocrlf false # Affects the non-Cygwin git.
36-
shell: pwsh # Do this outside Cygwin, to affect actions/checkout.
23+
git config --global core.autocrlf false
24+
shell: pwsh
3725

38-
- &checkout
39-
uses: actions/checkout@v6
26+
- uses: actions/checkout@v6
4027
with:
4128
fetch-depth: 0
4229

43-
- &install-cygwin
44-
name: Install Cygwin
30+
- name: Install Cygwin
4531
uses: cygwin/cygwin-install-action@v6
4632
with:
47-
packages: git python39 python-pip-wheel python-setuptools-wheel python-wheel-wheel
48-
add-to-path: false # No need to change $PATH outside the Cygwin environment.
33+
packages: git
34+
add-to-path: false
4935

50-
- &verbose-output
51-
name: Arrange for verbose output
36+
- name: AFTER actions/checkout, BEFORE submodule update — check git/ext/gitdb existence and owner
37+
shell: pwsh
5238
run: |
53-
# Arrange for verbose output but without shell environment setup details.
54-
echo 'set -x' >~/.bash_profile
55-
56-
- &safe-directory
57-
name: Special configuration for Cygwin git
39+
$repo = "D:\a\GitPython\GitPython"
40+
$paths = @(
41+
"$repo\git",
42+
"$repo\git\ext",
43+
"$repo\git\ext\gitdb",
44+
"$repo\git\ext\gitdb\.git",
45+
"$repo\.git",
46+
"$repo\.git\modules",
47+
"$repo\.git\modules\gitdb"
48+
)
49+
Write-Host "==================== POST-CHECKOUT, PRE-SUBMODULE-UPDATE ===================="
50+
foreach ($p in $paths) {
51+
Write-Host "==== $p"
52+
if (Test-Path -LiteralPath $p) {
53+
$item = Get-Item -LiteralPath $p -Force
54+
Write-Host "Type: $(if ($item.PSIsContainer) {'Directory'} else {'File'})"
55+
$acl = Get-Acl -LiteralPath $p
56+
Write-Host "Owner: $($acl.Owner)"
57+
if ($item.PSIsContainer) {
58+
$contents = @(Get-ChildItem -LiteralPath $p -Force | Select-Object -First 5 | ForEach-Object { $_.Name })
59+
Write-Host "Contents (first 5): $($contents -join ', ')"
60+
Write-Host "Total entries: $((Get-ChildItem -LiteralPath $p -Force).Count)"
61+
}
62+
} else {
63+
Write-Host "(does not exist)"
64+
}
65+
Write-Host ""
66+
}
67+
68+
- name: Cygwin-side check — same paths via stat
69+
run: |
70+
set +e
71+
echo "==================================================================="
72+
echo "Cygwin uid: $(id -u) ($(id -un))"
73+
echo "==================================================================="
74+
for path in \
75+
"$(pwd)/git" \
76+
"$(pwd)/git/ext" \
77+
"$(pwd)/git/ext/gitdb" \
78+
"$(pwd)/git/ext/gitdb/.git" \
79+
"$(pwd)/.git" \
80+
"$(pwd)/.git/modules" \
81+
"$(pwd)/.git/modules/gitdb"; do
82+
if [ -e "$path" ]; then
83+
echo "$(stat -c '%u(%U) %F' "$path") $path"
84+
else
85+
echo "(does not exist) $path"
86+
fi
87+
done
88+
89+
- name: Now run git submodule update --init --recursive
5890
run: |
5991
git config --global --add safe.directory "$(pwd)"
6092
git config --global --add safe.directory "$(pwd)/.git"
61-
git config --global --add safe.directory "$(pwd)/git/ext/gitdb"
62-
git config --global --add safe.directory "$(pwd)/git/ext/gitdb/gitdb/ext/smmap"
63-
git config --global core.autocrlf false
64-
65-
- &prepare-repo
66-
name: Prepare this repo for tests
67-
run: |
68-
./init-tests-after-clone.sh
69-
70-
- &git-identity
71-
name: Set git user identity and command aliases for the tests
72-
run: |
73-
git config --global user.email "travis@ci.com"
74-
git config --global user.name "Travis Runner"
75-
# If we rewrite the user's config by accident, we will mess it up
76-
# and cause subsequent tests to fail
77-
cat test/fixtures/.gitconfig >> ~/.gitconfig
78-
79-
- &setup-venv
80-
name: Set up virtual environment
81-
run: |
82-
python3.9 -m venv .venv
83-
echo 'BASH_ENV=.venv/bin/activate' >>"$GITHUB_ENV"
84-
85-
- &update-pypa
86-
name: Update PyPA packages
87-
run: |
88-
python -m pip install -U pip 'setuptools; python_version<"3.12"' wheel
89-
90-
- &install-deps
91-
name: Install project and test dependencies
92-
run: |
93-
pip install '.[test]'
94-
95-
- name: Show version and platform information
96-
run: |
97-
uname -a
98-
command -v git python
99-
git version
100-
python --version
101-
python -c 'import os, sys; print(f"sys.platform={sys.platform!r}, os.name={os.name!r}")'
102-
103-
- name: Test with pytest (${{ matrix.additional-pytest-args }})
104-
run: |
105-
pytest --color=yes -p no:sugar --instafail -vv ${{ matrix.additional-pytest-args }}
106-
107-
reproduce-safe-dir:
108-
strategy:
109-
matrix:
110-
run: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256]
111-
fail-fast: false
112-
113-
runs-on: windows-latest
114-
115-
env: *cygwin-env
116-
117-
defaults: *cygwin-defaults
118-
119-
steps:
120-
- *force-lf
121-
- *checkout
122-
- *install-cygwin
123-
- *verbose-output
124-
- *safe-directory
125-
- *prepare-repo
126-
- *git-identity
127-
- *setup-venv
128-
- *update-pypa
129-
- *install-deps
93+
git submodule update --init --recursive
13094
131-
- name: Run submodule tests
95+
- name: AFTER submodule update — confirm post-drop ownership pattern
96+
shell: pwsh
13297
run: |
133-
python -m pytest -vv \
134-
test/test_docs.py::Tutorials::test_submodules \
135-
test/test_repo.py::TestRepo::test_submodules \
136-
test/test_submodule.py::TestSubmodule::test_root_module
98+
$repo = "D:\a\GitPython\GitPython"
99+
$paths = @(
100+
"$repo\git\ext\gitdb",
101+
"$repo\git\ext\gitdb\.git",
102+
"$repo\.git\modules\gitdb",
103+
"$repo\git\ext\gitdb\gitdb\ext\smmap",
104+
"$repo\.git\modules\gitdb\modules\smmap"
105+
)
106+
Write-Host "==================== POST-SUBMODULE-UPDATE ===================="
107+
foreach ($p in $paths) {
108+
Write-Host "==== $p"
109+
if (Test-Path -LiteralPath $p) {
110+
$acl = Get-Acl -LiteralPath $p
111+
Write-Host "Owner: $($acl.Owner)"
112+
} else {
113+
Write-Host "(does not exist)"
114+
}
115+
}

0 commit comments

Comments
 (0)