From 19fafa90984d80508e8cb6548905b230245b5916 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Martins?= Date: Thu, 5 Sep 2024 01:07:01 +0200 Subject: [PATCH] cmd/release: unshallow repositories MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the repository is shallowed, we need to unshallow it in order to generate the post release PR properly. Signed-off-by: André Martins --- cmd/release/post-release.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/cmd/release/post-release.go b/cmd/release/post-release.go index a36d747..cb35dcb 100644 --- a/cmd/release/post-release.go +++ b/cmd/release/post-release.go @@ -52,9 +52,21 @@ func (pc *PostRelease) Run(ctx context.Context, yesToPrompt, dryRun bool, ghClie remoteBranch := fmt.Sprintf("%s/%s", remoteName, branch) // Pull docker manifests from RUN URL - _, err = execCommand(pc.cfg.RepoDirectory, "git", "fetch", "-q", remoteName) + shallowRepo, err := isShallowRepo(pc.cfg.RepoDirectory) if err != nil { - return err + io2.Fprintf(3, os.Stdout, "Unable to detect if repository is shallow, assuming it's not: %s\n", err) + } + if shallowRepo { + io2.Fprintf(3, os.Stdout, "Fetching and unshallowing repository to generate AUTHORS file properly\n") + _, err = execCommand(pc.cfg.RepoDirectory, "git", "fetch", "-q", "--unshallow", remoteName) + if err != nil { + return err + } + } else { + _, err = execCommand(pc.cfg.RepoDirectory, "git", "fetch", "-q", remoteName) + if err != nil { + return err + } } _, err = execCommand(pc.cfg.RepoDirectory, "git", "checkout", "-b", localBranch, remoteBranch)