git-mr-tag: don't allow users to add reserved tags
authorFrantisek Hrbata <frantisek@hrbata.com>
Wed, 16 Dec 2020 16:32:37 +0000 (17:32 +0100)
committerFrantisek Hrbata <frantisek@hrbata.com>
Wed, 16 Dec 2020 16:32:37 +0000 (17:32 +0100)
This would be caught by git-mr-update, but let's inform users about
this while the tag is created.

Signed-off-by: Frantisek Hrbata <frantisek@hrbata.com>
git-mr-tag

index 41d44d62e3490253deddbc59c1faee2acde229fe..5dfa0135e2c500d5f9d6abac322fdba46a434ce8 100755 (executable)
@@ -53,6 +53,9 @@ tag = args.tag.strip()
 if not tag.isalnum():
     sys.exit("Invalid tag name.")
 
+if tag in mrlib.reserved_tags:
+    sys.exit("Tag name '{}' is reserved.".format(tag))
+
 user = mrlib.get_user()
 refs = mrlib.load_refs()
 mr = mrlib.verify_mrs([args.mr], refs)[0]