From: Mike Frysinger Date: Sun, 28 Mar 2021 16:07:45 +0000 (-0400) Subject: git-rb-catchup: fix merge counts X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=b72cc58d2f39ef197504de8502b1d495a636cc80;p=home.git git-rb-catchup: fix merge counts --- 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!')