Skip to content

Commit

Permalink
Merge pull request #124 from x-motemen/unshallow
Browse files Browse the repository at this point in the history
unshallow if a shallow repository mainly for CI environment
  • Loading branch information
Songmu authored Oct 29, 2023
2 parents 8a3adf2 + 1f2b2d6 commit bbe41c8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,18 @@ var getGit = sync.OnceValue(func() func(...string) (string, error) {
if err != nil || g == "" {
return nil
}
return func(args ...string) (string, error) {
git := func(args ...string) (string, error) {
bb, err := exec.Command(g, args...).Output()
return strings.TrimSpace(string(bb)), err
}
if boolStr, err := git("rev-parse", "--is-shallow-repository"); err != nil {
return nil
} else if boolStr == "true" {
if _, err := git("fetch", "--unshallow"); err != nil {
return nil
}
}
return git
})

func modTime(fpath string) (time.Time, error) {
Expand Down

0 comments on commit bbe41c8

Please sign in to comment.