Skip to content

Commit

Permalink
Merge pull request #22 from Songmu/unshallow-initialize
Browse files Browse the repository at this point in the history
unshallow in initialize
  • Loading branch information
Songmu authored Aug 17, 2022
2 parents 424ce2b + f0d7807 commit cd3191d
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions rcpr.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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: "."},
}
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit cd3191d

Please sign in to comment.