mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:25:53 +01:00
[PR #922] [MERGED] check_no_game_data: exit 2 when git cannot list the files (CHECK-NO-GAME-DATA-GIT-ERROR) #960
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#960
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/922
Author: @TuroYT
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @QemmHD
Base:
main← Head:fix/check-no-game-data-git-error📝 Commits (2)
074e530check_no_game_data: exit 2 when git cannot list the files (CHECK-NO-GAME-DATA-GIT-ERROR)ec0d003test_check_no_game_data: drop GIT_DIR, GIT_WORK_TREE and GIT_INDEX_FILE in the outside-a-repository test📊 Changes
2 files changed (+49 additions, -4 deletions)
View changed files
📝
scripts/check_no_game_data.py(+18 -2)📝
tests/test_check_no_game_data.py(+31 -2)📄 Description
Claimed in the coordination issue as: CHECK-NO-GAME-DATA-GIT-ERROR (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7135522186)
What was wrong
tracked_filesinscripts/check_no_game_data.py(line 256, called frommain) runsgit ls-files -zwithcheck=Trueand no handler. Two cases end in a traceback and exit status 1:CalledProcessError ... status 128.FileNotFoundError: [Errno 2] No such file or directory: 'git'.The docstring says exit 1 means game data was found, so a caller cannot tell the two apart. Only the unreadable-file path returns 2.
Reproduced on the branch before the change:
What changed
maincatchesOSErrorandCalledProcessErroraround the default-mode git call and returns 2.check_no_game_data: cannot list the tracked files with git: <reason>. The reason is the first non-empty line git printed, or the OS error text.tests/test_check_no_game_data.py: two tests. One empties PATH and runs in a plain folder. The other setsGIT_CEILING_DIRECTORIESandLC_ALL=Cand runs in a folder outside any repository. Both expect exit 2, no stdout, one stderr line, and no traceback.Tested
python3 -I tests/test_check_no_game_data.py: Ran 11 tests, OK (on the fixed code).FAILED (failures=2)), so they catch the defect.python3 -I scripts/check_no_game_data.py > out.txton the origin/main copy and on the fixed script gives identical bytes, exit 0 for both.env PATH=/nonexistent /usr/bin/python3 -I scripts/check_no_game_data.pywith a file argument: exit 0 (no git call is made).env PATH=/nonexistent /usr/bin/python3 -I scripts/check_no_game_data.py: one line, exit 2.python3 -m compileall -q scripts tests: OK.python3 -I tests/test_text_write_line_endings.py: OK, 3 tests.python3 -I tests/test_no_game_data_workflow.py: OK, 3 tests.python3 -I scripts/check_no_game_data.py scripts/check_no_game_data.py tests/test_check_no_game_data.py: exit 0.python3 -I scripts/check_no_game_data.pyover the whole tracked tree: exit 0.git diff --check: clean.Not tested: a real git failure with a multi-line message (for example,
detected dubious ownership), a non-UTF-8 git message beyond a quick unit check of the helper, Windows, and macOS.Not tested
AI-assisted (Claude Code).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.