blob: dd48ad74f30d76c495969ead666df5d1d339b49a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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("")
}
|