diff options
| -rw-r--r-- | doBuild.go | 4 | ||||
| -rw-r--r-- | doGit.go | 33 | 
2 files changed, 25 insertions, 12 deletions
@@ -107,10 +107,8 @@ func doBuild() (string, error) {  				build = "yes"  				repo.DirtyList = cmd  				tobuild.Clone(repo) +				simpletable = append(simpletable, []string{debname, p.Version, age, smartver, bcount, curver, newcount, final, build, arches, cmdstr})  			} - -			simpletable = append(simpletable, []string{debname, p.Version, age, smartver, bcount, curver, newcount, final, build, arches, cmdstr}) -  		}  		footer := cobol.SimpleTable(simpletable) @@ -20,10 +20,18 @@ import (  	"go.wit.com/log"  ) -func doGitCreate(namespace string) (string, error) { +// git clone https://cgit.grid.wit.com/lib/windows/cexample +// go-clone --non-recursive --repo go.wit.com/lib/windows/cexample +// git branch devel +// git check devel +// git push --set-upstream origin devel +func doGitCreate(namespace string, template string) (string, error) {  	var s string  	var err error -	templateDir := "/var/lib/git/lib/templates/golib" +	if template == "" { +		template = "golib" +	} +	templateDir := filepath.Join("/var/lib/git/lib/templates", template)  	if !shell.IsDir(templateDir) {  		return "", errors.New("no template/golib")  	} @@ -32,12 +40,16 @@ func doGitCreate(namespace string) (string, error) {  		return "", errors.New("dir " + fullpath + " already exists")  	}  	basepath, _ := filepath.Split(fullpath) -	if err := os.MkdirAll(basepath, os.ModePerm); err != nil { -		return "", err +	if err = os.MkdirAll(basepath, os.ModePerm); err != nil { +		return "mkdir failed", err  	}  	cmd := []string{"cp", "-a", templateDir, fullpath} -	shell.RunVerbose(cmd) -	return s, err +	_, err = shell.RunVerbose(cmd) +	if err != nil { +		return "failed to create new repo", err +	} +	s = "created new repo" +	return s, nil  }  func runCommand(cmds []string) (string, error) { @@ -80,9 +92,12 @@ func doGit() (string, error) {  	}  	if argv.Git.Create != "" { -		s = "attmepting to create new repo" -	} -	if argv.Git.Template != "" { +		s, err = doGitCreate(argv.Git.Create, argv.Git.Template) +		if err == nil { +			return "created new repo " + argv.Git.Create, nil +		} +		s = "attmepting to ssh?" +		return s, err  	}  	if argv.Git.Edit != "" {  | 
