aboutsummaryrefslogtreecommitdiff
path: root/git-codereview/branch.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2015-12-13 17:08:01 -0500
committerAustin Clements <austin@google.com>2015-12-14 15:07:39 +0000
commitd146d647cc992aabf3c7cabc6baf29040ed13e23 (patch)
tree75375cf478986fc3259a65b29afbcef734931639 /git-codereview/branch.go
parent143352e9df416ac808f2bb75e8fd1cea5a038c5d (diff)
downloadgo-x-review-d146d647cc992aabf3c7cabc6baf29040ed13e23.tar.xz
git-codereview: fix branch "behind" count
git-codereview pending's count of how far behind a branch is is currently wrong. It computes this from the length of the string printed by git log --format=format:x, but forgets that git log automatically adds new lines between each commit. As a result, given that the true count is n, git pending prints 2n-1. Fix this by counting the number of lines printed by git log, not the number of characters. Change-Id: I5702a833d34333099cad7d88c03837088ac4f9a8 Reviewed-on: https://go-review.googlesource.com/17771 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'git-codereview/branch.go')
-rw-r--r--git-codereview/branch.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/git-codereview/branch.go b/git-codereview/branch.go
index b451507..1f08337 100644
--- a/git-codereview/branch.go
+++ b/git-codereview/branch.go
@@ -184,7 +184,7 @@ func (b *Branch) loadPending() {
}
}
b.commitsAhead = len(b.pending)
- b.commitsBehind = len(trim(cmdOutput("git", "log", "--format=format:x", b.FullName()+".."+b.OriginBranch(), "--")))
+ b.commitsBehind = len(lines(cmdOutput("git", "log", "--format=format:x", b.FullName()+".."+b.OriginBranch(), "--")))
}
// Submitted reports whether some form of b's pending commit