fix(git): checkout commit before updating submodules
Metadata
Current evaluation
Merged fix resolving issue #898. Updates the git deep-clone path to checkout the target commit before initializing submodules, aligning with shallow clone behavior. Includes targeted unit tests and passes all CI checks.
Suggested action: —
No scores available.
Issue body
## Summary
Fixes #898.
When cloning a git source pinned with `source-commit`, avoid initializing submodules during the initial clone.
The fallback deep-clone path now:
1. clones the repository without submodules,
2. fetches the requested commit,
3. checks out the requested commit,
4. updates submodules after the repository is at the requested commit.
This matches the existing shallow commit path and avoids initializing submodules from the wrong commit context.
## Validation
- `uv run pytest -q tests/unit/sources/test_git_source.py -rs`
- `uv run ruff check craft_parts/sources/git_source.py tests/unit/sources/test_git_source.py`
- `uv run ruff format --check craft_parts/sources/git_source.py tests/unit/sources/test_git_source.py`
- `git diff --check`
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged fix resolving issue #898. Updates the git deep-clone path to checkout the target commit before initializing submodules, aligning with shallow clone behavior. Includes targeted unit tests and passes all CI checks. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
25
Complexity:
20
Confidence:
85
|
needs review | Fixes git source cloning for source-commit by checking out the commit before updating submodules. Adds unit tests and addresses CI/review feedback. Currently awaiting maintainer review. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1378 fix: shallow clone with source-commit if possible | craft-parts | merged | Merged to resolve issue #1360 and CRAFT-4853. Optimizes shallow cloning when a source commit is available. Approved by two reviewers, passed all CI checks, and modified three files with 233 additions and 20 deletions. |