From b72cc58d2f39ef197504de8502b1d495a636cc80 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Sun, 28 Mar 2021 12:07:45 -0400
Subject: [PATCH] git-rb-catchup: fix merge counts

---
 .bin/git-rb-catchup | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/.bin/git-rb-catchup b/.bin/git-rb-catchup
index 2cc5c53..66b87a8 100755
--- a/.bin/git-rb-catchup
+++ b/.bin/git-rb-catchup
@@ -97,7 +97,8 @@ def rebase_bisect(lbranch: str,
 def get_ahead_behind(lbranch: str, rbranch: str) -> Tuple[int, int]:
     """Return number of commits |lbranch| is ahead & behind relative to |rbranch|."""
     output = git(
-        ['rev-list', '--left-right', '--count', f'{lbranch}...{rbranch}']).stdout
+        ['rev-list', '--first-parent', '--left-right', '--count',
+         f'{lbranch}...{rbranch}']).stdout
     return [int(x) for x in output.split()]
 
 
@@ -150,7 +151,7 @@ def main(argv: List[str]) -> int:
     opts = parser.parse_args(argv)
 
     lbranch = get_local_branch()
-    print(f'Local branch resolved to "{lbranch}"')
+    print(f'Local branch resolved to "{lbranch}".')
     if not lbranch:
         print('Unable to resolve local branch', file=sys.stderr)
         return 1
@@ -159,10 +160,11 @@ def main(argv: List[str]) -> int:
         rbranch = opts.branch
     else:
         rbranch = get_tracking_branch(lbranch)
-    print(f'Tracking branch resolved to "{rbranch}"')
+    print(f'Tracking branch resolved to "{rbranch}".')
 
     ahead, behind = get_ahead_behind(lbranch, rbranch)
-    print(f'Branch is {ahead} commits ahead and {behind} commits behind')
+    print(f'Branch is {ahead} commits ahead and {behind} commits behind.')
+    print('NB: Counts for the first parent in merge history, not all commits.')
 
     if not behind:
         print('Up-to-date!')
-- 
2.39.5