← Back to issue list

git: always fetch specified source-commit before using

View original Github issue

Metadata

Project
snapcraft
Number
#2968
Type
pull request
State
merged
Author
cjp256
Labels
—
Created
Updated
Closed

Current evaluation

Merged #2968 in commit 3941e7918; Git sources now fetch the requested source-commit from origin, fixing missing-commit and shallow-clone failures.

Resolution: closed resolved

Reason: Merged PR snapcraft#2968 as commit 3941e7918. It fetches the requested commit from origin before checkout, resolving failures caused by branch history and source-depth exclusions.

Evaluated by: mr-cal-bot

No scores available.

Issue body

Two cases where git will fail on specified source-commit: - commit ID is not in specified branch history (or master, if no branch is specified). - source-depth is used which doesn't contain neccessary commit ID. This commit changes the git module to fetch the reference from origin before attempting to use it. LP: #1817907 Signed-off-by: Chris Patterson <chris.patterson@canonical.com> - [ ] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)? - [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? - [ ] Have you successfully run `./runtests.sh static`? - [ ] Have you successfully run `./runtests.sh tests/unit`? -----

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged #2968 in commit 3941e7918; Git sources now fetch the requested source-commit from origin, fixing missing-commit and shallow-clone failures.
stealth/space-bunny-alpha — closed resolved Merged #2968 (commit 3941e7918): Git sources now fetch the requested source-commit from origin, fixing missing-commit and shallow-clone failures.
qwen/qwen3.6-35b-a3b — — Merged. The git module now fetches the specified source-commit from origin before use, preventing failures when the commit is absent from local history or excluded by shallow clones. Approved by two reviewers and passed CI.
qwen3.6-35b-a3b-mtp-q6 — — Merged a fix for the git module that fails when a specified source-commit is absent from local history or depth-limited clones. The change fetches the reference from origin before use, resolving LP #1817907.

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 PR #1378 as ae26318e: Git pulls now prefer a shallow fetch for source-commit when possible, with deep-fetch fallback, fixing #1360.
81%
#1476 fix(git-source): only shallow fetch if a source-depth is provided craft-parts merged Merged as commit f1e2c927 (#1476): git-source now shallow-clones only when a non-zero source-depth is set, so full-hash source-commit no longer forces a shallow fetch. Released in craft-parts 2.28.1 and merged back via #1481.
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%
#248 Git source: Make a shallow clone. snapcraft merged Merged #248 (commit 6ebd8e68d; merge 321b13277), changing Git sources from full clones to depth-1 shallow clones and resolving LP #1536696.
72%