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

alert user when a commit cannot be resolved

Changeset 7f3c3aaa2bd2

Parent f0b71af5901f

by Profile picture of User 12Benjamin Pollack <benjamin@fogcreek.com>

Changes to 2 files · Browse files at 7f3c3aaa2bd2 Showing diff from parent f0b71af5901f Diff from another changeset...

Change 1 of 1 Show Entire File kiln/​kiln.go Stacked
 
125
126
127
128
 
 
129
130
131
 
132
133
134
 
 
135
136
137
 
125
126
127
 
128
129
130
131
 
132
133
134
135
136
137
138
139
140
@@ -125,13 +125,16 @@
   // Browse a commit, expanding out to the full SHA beforehand  func (k *KilnClient) BrowseCommit(repo string, commit string) (err error) { - if out, err := exec.Command("git", "rev-parse", commit).Output(); err == nil { + var out []byte + if out, err = exec.Command("git", "rev-parse", commit).CombinedOutput(); err == nil {   commit = strings.TrimSpace(string(out))   if strings.HasPrefix(commit, "fatal:") { - err = fmt.Errorf("commit couldn't be resolved (try \"git fetch\")\n") + err = fmt.Errorf("commit couldn't be resolved (try \"git fetch\" first)")   } else {   browse(k.repoRoute(repo, "History/"+commit))   } + } else { + err = fmt.Errorf("commit couldn't be resolved (try \"git fetch\" first)")   }   return  }
Change 1 of 1 Show Entire File main.go Stacked
 
240
241
242
243
 
 
 
244
245
246
 
240
241
242
 
243
244
245
246
247
248
@@ -240,7 +240,9 @@
  case "show":   if ensureArgs(3, "you must supply at least one commit SHA to show") {   for _, commit := range os.Args[2:len(os.Args)] { - k.BrowseCommit(repoPath, commit) + if err := k.BrowseCommit(repoPath, commit); err != nil { + fmt.Fprintf(os.Stderr, "couldn't load commit: %v\n", err) + }   }   }   case "showfile":