Changeset 7f3c3aaa2bd2…
Parent f0b71af5901f…
by Benjamin Pollack <benjamin@fogcreek.com>
Changes to 2 files · Browse files at 7f3c3aaa2bd2 Showing diff from parent f0b71af5901f Diff from another changeset...
@@ -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
}
|
@@ -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":
|
Loading...