From f0d78071fc13f5ae36ee241d5861f5c22e318352 Mon Sep 17 00:00:00 2001 From: Songmu Date: Wed, 17 Aug 2022 14:31:19 +0900 Subject: [PATCH] unshallow in initialize --- rcpr.go | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/rcpr.go b/rcpr.go index 5160049..587fd98 100644 --- a/rcpr.go +++ b/rcpr.go @@ -79,6 +79,16 @@ func (rp *rcpr) initialize(ctx context.Context) error { return err } rp.gh = cli + + isShallow, _, err := rp.c.gitE("rev-parse", "--is-shallow-repository") + if err != nil { + return err + } + if isShallow == "true" { + if _, _, err := rp.c.gitE("fetch", "--unshallow"); err != nil { + return err + } + } return nil } @@ -105,6 +115,7 @@ func Run(ctx context.Context, argv []string, outStream, errStream io.Writer) err return printVersion(outStream) } + // main logic follows rp := &rcpr{ c: &commander{outStream: outStream, errStream: errStream, dir: "."}, } @@ -138,16 +149,6 @@ func Run(ctx context.Context, argv []string, outStream, errStream io.Writer) err releaseBranch, branch) } - isShallow, _, err := rp.c.gitE("rev-parse", "--is-shallow-repository") - if err != nil { - return err - } - if isShallow == "true" { - if _, _, err := rp.c.gitE("fetch", "--unshallow"); err != nil { - return err - } - } - if _, _, err := rp.c.gitE("config", "user.email"); err != nil { rp.c.git("config", "--local", "user.email", gitEmail) }