]> git.0d.be Git - git-acab.git/blobdiff - git-acab
add option to have acab at the end of the commit hash
[git-acab.git] / git-acab
index 159933ba52cc075e25495b2ed96fccb1e593788c..e42d3f6cffc9d6260031d5d1eb9e7f0b017ff86d 100755 (executable)
--- 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: