← Back to issue list

Git source clones all history

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1536696
Type
issue
State
closed
Author
~kyrofa
Labels
—
Created
Updated
Closed

Current evaluation

Fixed by merged PR canonical/snapcraft#248 (commit 6ebd8e68d, merge 321b13277): Git sources now use a depth-1 shallow clone instead of fetching full history. Maintainer kyrofa linked the PR as the fix for LP #1536696.

Resolution: closed resolved

Reason: Commit 6ebd8e68d "Git source: Make a shallow clone." was merged via PR #248 (merge commit 321b13277, branch feature/1536696/git_clones_all_history), and kyrofa commented linking that PR as the fix. Later work made the depth configurable via source-depth (#814/#829), but the default shallow clone landed here.

Evaluated by: mr-cal-bot

No scores available.

Issue body

When specifying the `source` of a part to be a Git repository, Snapcraft clones the entire branch/tag's history, which can potentially be massive. There's really no reason to do this-- Snapcraft only needs the most recent commit.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Fixed by merged PR canonical/snapcraft#248 (commit 6ebd8e68d, merge 321b13277): Git sources now use a depth-1 shallow clone instead of fetching full history. Maintainer kyrofa linked the PR as the fix for LP #1536696.
stealth/space-bunny-alpha — closed resolved Fixed by merged PR canonical/snapcraft#248 (commit 6ebd8e68d, merge 321b13277): git source now performs depth-1 shallow clones instead of fetching full history. Maintainer linked the PR as the fix (Launchpad bug #1536696).
stealth/space-bunny-alpha — closed resolved Fixed by canonical/snapcraft#248 (commit 6ebd8e68d), making Git source pulls use depth-1 shallow clones instead of downloading entire branch or tag histories.
qwen/qwen3.6-35b-a3b — — Closed without resolution. Likely abandoned or superseded by a later update, as no comments or fix details were recorded.
qwen/qwen3.6-35b-a3b — — Closed without implementation. The report that Snapcraft unnecessarily clones full Git history instead of fetching only the latest commit was abandoned due to prolonged inactivity.
qwen/qwen3.6-35b-a3b — — Closed without resolution. The request to optimize Snapcraft Git source cloning to fetch only the latest commit was abandoned due to lack of discussion.
qwen3.6-35b-a3b-mtp-q6 — — Closed without resolution. The unnecessary full Git history cloning behavior was abandoned or superseded by updated source handling. No fix or merge was implemented.

Update history

Date Change
created

Related work

  • Likely Fixed By: canonical/snapcraft#248 (confidence 98%)

    Merged PR that changed Git source handling to a depth-1 shallow clone; commit 6ebd8e68d, merge 321b13277, branch named after this bug.

  • Related To: snapcraft#814 (confidence 65%)

    Later made source-depth a parameter and opt-in, building on the shallow-clone behaviour introduced by #248.

Related issues

Issue Project State Summary Similarity
#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.
79%
#1617783 Git clone with --depth=1 loses the tags snapcraft (launchpad) closed Fixed by merged PR snapcore/snapcraft#814 (commit 190463c3c): Git clones became full-depth by default, with source-depth available as an explicit opt-in.
74%
#250 Backport to 1.x: Git source: Make a shallow clone. snapcraft merged Merged PR #250 backported #248 to 1.x, making Git sources use shallow clones instead of downloading full repository history.
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.
74%
#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.
72%
#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.
70%