From f638a25529bc9aae84f21aaa25fe8a2cc5b63a30 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 14 May 2026 18:01:17 -0600 Subject: [PATCH] fix(webicached): use full gittag fetch for first-time supplementary clones When a package has a git_url but uses a non-gittag source, the supplementary git clone was always shallow. For packages never cloned before, a shallow clone may miss older tags that clients need. Now: check whether the _gittag raw cache is already populated. If it is, reuse the shallow flag (fast refresh). If it is not, force a full clone so all tags are available from the first fetch. The --shallow flag (global) still overrides this so operators can cap fetch depth when needed. --- cmd/webicached/main.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/webicached/main.go b/cmd/webicached/main.go index 161e252..d15de95 100644 --- a/cmd/webicached/main.go +++ b/cmd/webicached/main.go @@ -568,7 +568,14 @@ func (wc *WebiCache) fetchRaw(ctx context.Context, pkg pkgConf, shallow bool) er // commit hashes. Git entries are classified from this data in // refreshPackage, not from the main raw cache. if pkg.conf.GitURL != "" && pkg.conf.Source != "gittag" { - if err := wc.fetchGitTagSupplementary(ctx, pkg.name, pkg.conf.GitURL, shallow); err != nil { + gitShallow := shallow + if !wc.Shallow { + gd, gdErr := rawcache.Open(filepath.Join(wc.RawDir, "_gittag", pkg.name)) + if gdErr == nil && !gd.Populated() { + gitShallow = false + } + } + if err := wc.fetchGitTagSupplementary(ctx, pkg.name, pkg.conf.GitURL, gitShallow); err != nil { log.Printf(" %s: supplementary gittag fetch: %v", pkg.name, err) } }