Skip to content

Commit 4a9cc37

Browse files
committed
Drop compat mode
So that signatures are verifiable using any implementation
1 parent 53355ac commit 4a9cc37

File tree

2 files changed

+7
-34
lines changed

2 files changed

+7
-34
lines changed

README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,11 @@ git evtag --sign TAG -m "Tag Message"
4646
# checksum to it. Uses the message from the file 'FILE' as the tag
4747
# message
4848
git evtag --sign TAG -F FILE
49-
50-
# Produces 'Git-EVTag-v0-SHA512' prefixed output
51-
git evtag --compat
52-
git evtag --compat --sign TAG
5349
```
5450

5551
```sh
5652
$ git evtag -h
57-
usage: git-evtag [-h] [--rev REV] [--repo REPO] [--verify VERIFY] [--sign SIGN] [--compat] [-m TAG_MESSAGE | -F TAG_MESSAGE_FILE]
53+
usage: git-evtag [-h] [--rev REV] [--repo REPO] [--verify VERIFY] [--sign SIGN] [-m TAG_MESSAGE | -F TAG_MESSAGE_FILE]
5854

5955
EVTag checksum of a git repository
6056

@@ -63,8 +59,7 @@ options:
6359
--rev REV Git revision (default: HEAD)
6460
--repo REPO Path to the git repository (default: PWD)
6561
--verify VERIFY Verify the EVTag checksum of the input tag
66-
--sign SIGN Create a signed and annotated tag and append the EVTag checksum
67-
--compat Produce 'Git-EVTag-v0-SHA512' prefixed output
62+
--sign SIGN Create a signed and annotated tag from HEAD and append the EVTag checksum
6863
-m, --tag-message TAG_MESSAGE
6964
Use the input message as the tag message
7065
-F, --tag-message-file TAG_MESSAGE_FILE

git_evtag_py.py

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ def extract_checksum_from_tag(repo: Path, tag: str) -> str | None:
8585
)
8686

8787
for line in result.stdout.splitlines():
88-
if line.strip().startswith("Git-EVTag-Py-v0-SHA512: "):
89-
return line.split("Git-EVTag-Py-v0-SHA512: ", 1)[1].strip()
9088
if line.strip().startswith("Git-EVTag-v0-SHA512: "):
9189
return line.split("Git-EVTag-v0-SHA512: ", 1)[1].strip()
9290
return None
@@ -98,7 +96,6 @@ def sign_tree_checksum(
9896
repo: Path,
9997
tag: str,
10098
in_csum: str,
101-
compat: bool = False,
10299
tag_msg: str | None = None,
103100
tag_msg_file: Path | None = None,
104101
) -> None:
@@ -134,17 +131,9 @@ def sign_tree_checksum(
134131
message = tmp.read()
135132
unlink(tmp.name)
136133

137-
pattern = (
138-
r"\n?Git-EVTag-v0-SHA512: .*\n?"
139-
if compat
140-
else r"\n?Git-EVTag-Py-v0-SHA512: .*\n?"
141-
)
134+
pattern = r"\n?Git-EVTag-v0-SHA512: .*\n?"
142135
cleaned_msg = re.sub(pattern, "", message, flags=re.DOTALL).rstrip()
143-
footer = (
144-
f"\n\nGit-EVTag-v0-SHA512: {in_csum}\n"
145-
if compat
146-
else f"\n\nGit-EVTag-Py-v0-SHA512: {in_csum}\n"
147-
)
136+
footer = f"\n\nGit-EVTag-v0-SHA512: {in_csum}\n"
148137
final_msg = cleaned_msg + footer
149138

150139
subprocess.run(
@@ -398,11 +387,6 @@ def parse_args() -> argparse.Namespace:
398387
"Create a signed and annotated tag from HEAD and append the EVTag checksum"
399388
),
400389
)
401-
parser.add_argument(
402-
"--compat",
403-
action="store_true",
404-
help="Produce 'Git-EVTag-v0-SHA512' prefixed output",
405-
)
406390
tag_msg = parser.add_mutually_exclusive_group()
407391
tag_msg.add_argument(
408392
"-m", "--tag-message", help="Use the input message as the tag message"
@@ -465,25 +449,19 @@ def main() -> int:
465449
calc_evtag_csum = checksum.get_digest()
466450

467451
if not (args.verify or args.sign):
468-
if args.compat:
469-
print(f"Git-EVTag-v0-SHA512: {calc_evtag_csum}") # noqa: T201
470-
else:
471-
print(f"Git-EVTag-Py-v0-SHA512: {calc_evtag_csum}") # noqa: T201
452+
print(f"Git-EVTag-v0-SHA512: {calc_evtag_csum}") # noqa: T201
472453
elif args.sign and in_tag:
473454
if args.tag_message:
474-
sign_tree_checksum(
475-
repo, in_tag, calc_evtag_csum, args.compat, tag_msg=args.tag_message
476-
)
455+
sign_tree_checksum(repo, in_tag, calc_evtag_csum, tag_msg=args.tag_message)
477456
elif args.tag_message_file:
478457
sign_tree_checksum(
479458
repo,
480459
in_tag,
481460
calc_evtag_csum,
482-
args.compat,
483461
tag_msg_file=args.tag_message_file,
484462
)
485463
else:
486-
sign_tree_checksum(repo, in_tag, calc_evtag_csum, args.compat)
464+
sign_tree_checksum(repo, in_tag, calc_evtag_csum)
487465
elif (
488466
args.verify
489467
and in_tag

0 commit comments

Comments
 (0)