diff options
| author | Jeff Carr <[email protected]> | 2025-09-27 14:22:41 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-09-27 16:33:47 -0500 |
| commit | 61b648c04fc3f5afa760b8840583e1335cd76229 (patch) | |
| tree | 6c47626a7aabf5a6c9cb5cc47714887f69cc7021 /cgit-clone/main.go | |
| parent | 7a6a5a2582f2926a1a9f806b113bc4a54d4a34f5 (diff) | |
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("") +} |
