Changeset 80b4194d51bf…
Parent 2c5ffd1cc996…
by
Changes to one file · Browse files at 80b4194d51bf Showing diff from parent 2c5ffd1cc996 Diff from another changeset...
@@ -216,12 +216,19 @@ case "create-branch":
if ensureArgs(3, "you must provide a branch name to create") {
requireAuth(k)
- r, err := k.CreateBranch(repoPath, os.Args[2])
+ branchName := os.Args[2]
+ r, err := k.CreateBranch(repoPath, branchName)
if err != nil {
fmt.Fprintf(os.Stderr, "could not create branch: %v\n", err)
- } else {
- fmt.Printf("created: %v\n", r.GitUrl)
- }
+ return
+ }
+ fmt.Printf("created branch repository \"%v\"\n", r.GitUrl)
+ out, err := exec.Command("git", "remote", "add", branchName, r.GitUrl).CombinedOutput()
+ if err != nil || strings.HasPrefix(string(out), "fatal: ") {
+ fmt.Fprintf(os.Stderr, "could not add remote: %s", out)
+ return
+ }
+ fmt.Printf("added \"%v\" as remote for \"%v\"\n", branchName, r.GitUrl)
}
case "filehistory":
if ensureArgs(3, "you must provide at least one file to view") {
|
Loading...