Fix git metadata detection for deploy with bare manifest filename#815
Open
nealrichardson wants to merge 2 commits into
Open
Fix git metadata detection for deploy with bare manifest filename#815nealrichardson wants to merge 2 commits into
nealrichardson wants to merge 2 commits into
Conversation
dirname("manifest.json") yields "", which subprocess rejects as cwd,
causing git metadata detection to be silently skipped. Fall back to the
current directory in _run_git_command.
Fixes #770
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Resolves #770.
rsconnect deploy manifest manifest.json(and other deploy commands given a bare relative filename) failed to attach git metadata to the bundle upload, even inside a git checkout.Approach
The deploy commands derive the directory to scan for git metadata with
dirname(file). For a bare filename likemanifest.json,os.path.dirname("manifest.json")returns"". That empty string was passed straight tosubprocess.run(..., cwd=""), which raisesFileNotFoundError;_run_git_commandcatches it and returnsNone, sois_git_repo("")returnedFalseand metadata detection was silently skipped — the "short-circuit" described in the issue.The fix normalizes an empty
cwdto"."at the single choke point (_run_git_command), so it covers every deploy command that derivesbase_dirviadirname(...), not justdeploy manifest.Type of Change
Automated Tests
Added two tests in
tests/test_git_metadata.pycovering the empty-directory-uses-cwd behavior (is_git_repo("")anddetect_git_metadata("")from within a git repo). All tests in the file pass; ruff format/check clean.Checklist
🤖 Generated with Claude Code