← Back to issue list

fix(git): checkout commit before updating submodules

View original Github issue

Metadata

Project
craft-parts
Number
#1600
Type
pull request
State
merged
Author
gcomneno
Labels
—
Created
Updated
Closed

Current evaluation

PR #1600 (commit d2845976) merged, fixing #898: the deep-clone fallback for source-commit now clones without submodules, fetches and checks out the commit, then updates submodules, matching the shallow path.

Resolution: closed resolved

Reason: Merged into main as d2845976 with all CI checks green; the change landed in craft_parts/sources/git_source.py and was added via shared _clone_at_commit()/_update_submodules() logic plus unit tests.

Evaluated by: mr-cal-bot

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
stealth/space-bunny-alpha — closed resolved PR #1600 (commit d2845976) merged, fixing #898: the deep-clone fallback for source-commit now clones without submodules, fetches and checks out the commit, then updates submodules, matching the shallow path.
stealth/space-bunny-alpha — closed resolved Merged craft-parts PR #1600 (d2845976), fixing #898 by checking out the requested source-commit before initializing submodules in the deep-clone fallback.
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.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/craft-parts#898 (confidence 100%)

    Original issue 'Git source should check out a commit before recursing submodules', closed by this PR.

  • Related To: canonical/craft-parts#1378 (confidence 70%)

    Earlier commit ae26318e added the shallow clone-with-source-commit path that this PR now matches.

  • Related To: canonical/craft-parts#1476 (confidence 55%)

    Commit f1e2c927 adjusted shallow fetching, part of the same git source clone/fetch logic.

Related issues

No related issues found above the similarity threshold.