aboutsummaryrefslogtreecommitdiff
path: root/lib/git
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2018-09-15 03:41:33 +0700
committerShulhan <ms@kilabit.info>2018-09-15 03:41:33 +0700
commit9388affb80208eaeeeae776449fa40a414f475cb (patch)
tree52aefff950b5bf1e960236418f98d13482cc5248 /lib/git
parent92fd877512f911d1e98ac2bb7c742466d4c3a65b (diff)
downloadpakakeh.go-9388affb80208eaeeeae776449fa40a414f475cb.tar.xz
lib/git: fetch tags when calling FetchAll
Diffstat (limited to 'lib/git')
-rw-r--r--lib/git/git.go21
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/git/git.go b/lib/git/git.go
index 632f6bb4..c2c38670 100644
--- a/lib/git/git.go
+++ b/lib/git/git.go
@@ -137,7 +137,7 @@ func Clone(remoteURL, dest string) (err error) {
}
//
-// FetchAll will fetch the latest commits from remote.
+// FetchAll will fetch the latest commits and tags from remote.
//
func FetchAll(repoDir string) error {
cmd := exec.Command("git", "fetch")
@@ -158,6 +158,25 @@ func FetchAll(repoDir string) error {
err = fmt.Errorf("FetchAll: %s", err)
}
+ // Fetch all tags.
+ cmd = exec.Command("git", "fetch")
+ if debug.Value == 0 {
+ cmd.Args = append(cmd.Args, "--quiet")
+ }
+ cmd.Args = append(cmd.Args, "--tags")
+ cmd.Dir = repoDir
+ cmd.Stdout = _stdout
+ cmd.Stderr = _stderr
+
+ if debug.Value >= 1 {
+ fmt.Printf("= FetchAll %s %s\n", cmd.Dir, cmd.Args)
+ }
+
+ err = cmd.Run()
+ if err != nil {
+ err = fmt.Errorf("FetchAll: %s", err)
+ }
+
return err
}