diff options
Diffstat (limited to 'cgit-clone/main.go')
| -rw-r--r-- | cgit-clone/main.go | 52 | 
1 files changed, 52 insertions, 0 deletions
diff --git a/cgit-clone/main.go b/cgit-clone/main.go new file mode 100644 index 0000000..dd48ad7 --- /dev/null +++ b/cgit-clone/main.go @@ -0,0 +1,52 @@ +// Copyright 2017-2025 WIT.COM Inc. All rights reserved. +// Use of this source code is governed by the GPL 3.0 + +package main + +// An app to submit patches for the 30 GO GUI repos + +import ( +	"os" +	"path/filepath" + +	"go.wit.com/lib/gui/prep" +	"go.wit.com/lib/gui/shell" +	"go.wit.com/lib/protobuf/forgepb" +	"go.wit.com/log" +) + +// sent via -ldflags +var VERSION string +var BUILDTIME string + +// used for shell auto completion +var ARGNAME string = "cgit-clone" + +func main() { +	me = new(mainType) +	me.auto = prep.Bash(&argv) // adds auto complete to go-args + +	// the current forge init process +	me.forge = forgepb.Init() // init forge.pb + +	homedir := "/var/lib/git" +	if err := os.Chdir(homedir); err != nil { +		badExit(err) +	} + +	for repo := range me.forge.Repos.IterAll() { +		fulldir := filepath.Join(repo.FullPath, ".git") +		cgitdir := repo.Namespace + ".git" +		if shell.IsDir(filepath.Join(homedir, cgitdir)) { +			// log.Info("already have", filepath.Join(homedir, cgitdir)) +			continue +		} else { +			// log.Info("need", filepath.Join(homedir, cgitdir)) +		} + +		cmd := []string{"git", "clone", "--bare", fulldir, cgitdir} +		log.Info(cmd) +		shell.RunVerbose(cmd) +	} +	okExit("") +}  | 
