From: Frédéric Péters Date: Thu, 26 Aug 2021 06:23:34 +0000 (+0200) Subject: add option to have acab at the end of the commit hash X-Git-Url: https://git.0d.be/?p=git-acab.git;a=commitdiff_plain;h=e705f8d384d8289d96bd504c436c3126acf2acab add option to have acab at the end of the commit hash --- diff --git a/git-acab b/git-acab index 159933b..e42d3f6 100755 --- a/git-acab +++ b/git-acab @@ -10,6 +10,7 @@ import time parser = argparse.ArgumentParser() parser.add_argument('--start', type=str, default='commit', help='now or commit') parser.add_argument('--prefix', action='store_true') +parser.add_argument('--suffix', action='store_true') parser.add_argument('-v', '--verbose', action='store_true') args = parser.parse_args() @@ -56,10 +57,11 @@ while True: capture_output=True, ) p = subprocess.run(['git', 'rev-parse', 'HEAD'], capture_output=True) - if args.prefix: - if b'acab' == p.stdout[:4]: - break - elif b'acab' in p.stdout: + if args.prefix and not p.stdout.startswith(b'acab'): + continue + if args.suffix and not p.stdout.strip().endswith(b'acab'): + continue + if b'acab' in p.stdout: break if args.verbose: