← Back to issue list

Git source should check out a commit before recursing submodules

View original Github issue

Metadata

Project
craft-parts
Number
#898
Type
issue
State
closed
Author
mr-cal
Labels
Status: Triaged Type: Bug
Created
Updated
Closed

Current evaluation

Fixed in craft-parts PR #1600 (commit d2845976): Git sources now check out the requested commit before running the recursive submodule update, instead of fetching submodules at the default branch first.

Resolution: closed resolved

Reason: The GitSource provision flow was reordered so the requested commit is fetched/checked out before `submodule update --recursive --force` runs, merged as commit d2845976 via PR #1600 in craft-parts/sources/git_source.py. This addresses the upstream reproducer in Launchpad bug 1999219 and internal ticket CRAFT-3661.

Evaluated by: mr-cal-bot

No scores available.

Issue body

### What needs to get done Clone the remote, fetch by the commit, the recurse submodules. ### Why it needs to get done Craft-parts currently clones a project, recursively fetches submodules, then checks out a specific commit. Fetching submodules before switching to the commit is incorrect and can fail. @dariuszd21 can advise on this task as he has been working with these types of fetching scenarios. source: @tomponline via https://github.com/canonical/lxd-pkg-snap/pull/594/files#r1831605307

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Fixed in craft-parts PR #1600 (commit d2845976): Git sources now check out the requested commit before running the recursive submodule update, instead of fetching submodules at the default branch first.
stealth/space-bunny-alpha — closed resolved Fixed in craft-parts PR #1600 (commit d2845976): Git sources now check out the requested commit before updating submodules.
qwen/qwen3.6-35b-a3b — — Closed without resolution, likely abandoned. Fix requires checking out the target commit before recursing submodules. A maintainer triaged it, linked an upstream report, and a contributor volunteered, but no fix was implemented.
qwen/qwen3.6-35b-a3b — — Closed without a documented fix. A contributor volunteered to correct the submodule fetch order and add tests, but no resolution or merge is recorded.
qwen/qwen3.6-35b-a3b — — Closed after a contributor volunteered to implement the fix by checking out the commit before recursing submodules and adding test coverage.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: canonical/craft-parts#1600 (confidence 92%)

    Commit d2845976 'fix(git): checkout commit before updating submodules (#1600)' reorders clone/fetch, checkout, then submodule update in craft_parts/sources/git_source.py.

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

    Earlier shallow-clone-with-commit work in the same file that the new checkout-then-submodule ordering builds on.

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

    Pre-existing shallow fetch fix in the same Git source fetch sequence.

Related issues

Issue Project State Summary Similarity
#1999219 snapcraft checks only default branch for submodules snapcraft (launchpad) closed Bug was upstream in craft-parts: git source cloned --recursive then checked out source-commit, so submodules were only fetched from the default branch. Fixed by craft-parts PR #1600 (commit d2845976); snapcraft issue closed once that landed.
76%
#1600 fix(git): checkout commit before updating submodules craft-parts merged 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.
74%
#249 Git source: Support submodules. snapcraft merged Merged canonical/snapcraft#249 via 1984cb339, adding recursive Git cloning and submodule updates on pull to resolve LP #1536698.
72%