← Back to issue list

Git clone with --depth=1 loses the tags

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1617783
Type
issue
State
closed
Author
~sabdfl
Labels
sources
Created
Updated
Closed

Current evaluation

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.

Resolution: closed resolved

Reason: PR snapcore/snapcraft#814 made source-depth opt-in and removed default depth-1 cloning, preserving Git tags for builds that require them.

Evaluated by: mr-cal-bot

No scores available.

Issue body

I have a part which is failing because the upstream uses tags in the git tree explicitly as part of the build process. THe snapcraft clone however uses --depth=1 which means those tags are lost. We should by default clone the entire git repository. A snapcraft part should be able to specify a shallow clone by providing an explicit depth. Can we make it so you can specify 'source-depth: n' in the part specification if you want a shallow clone (typically n would be 1) but that otherwise snapcraft will by default omit the depth and make a full clone of the repository?

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved 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.
stealth/space-bunny-alpha — closed resolved Shallow git clones (--depth=1) stripped tags and broke builds. Fixed by merged PR snapcore/snapcraft#814 (commit 190463c3c): source-depth became an opt-in part property and clones are full by default.
stealth/space-bunny-alpha — closed resolved Full Git cloning became the default and source-depth became opt-in through merged PR #814 (commit 190463c3c).
qwen/qwen3.6-35b-a3b — — Closed without resolution. The proposal to default to full git clones and add an optional source-depth parameter was abandoned due to inactivity. No fix or implementation was provided.
qwen/qwen3.6-35b-a3b — — Closed without implementation or discussion, likely abandoned. No source-depth option was added and the default shallow clone behavior remained unchanged.
qwen/qwen3.6-35b-a3b — — Closed without implementation. The proposal to default to full git clones and add a configurable source-depth parameter was abandoned. Snapcraft retains its default shallow clone behavior.

Update history

Date Change
created

Related work

  • Likely Fixed By: snapcore/snapcraft#814 (confidence 100%)

    Merged as commit 190463c3c with the title "Make source-depth a parameter and opt-in".

Related issues

Issue Project State Summary Similarity
#1536696 Git source clones all history snapcraft (launchpad) closed 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.
74%
#792 Fix `git clone` when transport is http and it does not support --depth snapcraft closed PR #792 (drop --depth=1 for HTTP git sources) was closed unmerged; maintainers landed the fix differently in merged PR #814 (commit 190463c3c), making shallow clones opt-in via the source-depth part property, tracking LP bug #1617783.
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.
73%
#790 Reduces download time of `git clone` fetching just a single branch. snapcraft closed Rejected unmerged: Snapcraft already used --depth=1, which implied --single-branch, so the proposed flag added nothing and risked the same limitations.
71%
#1965792 source-depth should propagate to git submodules snapcraft (launchpad) open Feature request: source-depth only shallow-clones the parent repo; git submodule update runs without --depth, so submodule-heavy builds (e.g. qt5) fetch full submodule history. Untriaged, no maintainer response.
70%