Kiln » gitkiln Read More
Clone URL:  
Pushed to one repository · View In Graph Contained in master

automatically add remotes for repos made via create-branch

Changeset 80b4194d51bf

Parent 2c5ffd1cc996

by Benjamin Pollack

Changes to one file · Browse files at 80b4194d51bf Showing diff from parent 2c5ffd1cc996 Diff from another changeset...

Change 1 of 1 Show Entire File main.go Stacked
 
216
217
218
219
 
 
220
221
222
223
224
 
 
 
 
 
 
 
 
 
225
226
227
 
216
217
218
 
219
220
221
222
 
 
 
223
224
225
226
227
228
229
230
231
232
233
234
@@ -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") {