Repository navigation
Default missing/empty rev to main before checkout - #535
Merged
jacebrowning merged 2 commits intoNov 9, 2026
Merged
jacebrowning merged 2 commits into
jacebrowning merged 2 commits into
Conversation
When `rev` is omitted from `.gitman.yml`, datafiles loads it as an empty string, which bypasses the dataclass default of `"main"` and causes `git checkout --force ""` to fail. Normalize empty/missing rev to `"main"` in `Source.__post_init__`, matching the documented default. Fixes jacebrowning#533
|
Hey @Muhtasim-Munif-Fahim can you fix the tests from the failed check? |
jacebrowning
self-requested a review
November 9, 2026 20:26
jacebrowning
approved these changes
Nov 9, 2026
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.
Summary
When
revis omitted from a source in.gitman.yml, datafiles loads the nested dataclass field as an empty string. That bypasses the declared default of"main"and leads togit checkout --force "", which fails with:Source.__post_init__now treats a missing/emptyrevas"main", matching the documented default.Fixes #533
Test plan
Nonerev valuesrevkey yieldsrev == "main"pytest gitman/tests/test_models_source.pypassesAI assistance was used while preparing this change.