From e705f8d384d8289d96bd504c436c3126acf2acab Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Thu, 26 Aug 2021 08:23:34 +0200 Subject: [PATCH] add option to have acab at the end of the commit hash --- git-acab | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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: -- 2.39.2