maint: Make "squash-subtree" script to store commit date in "git-subtree.json"

This is redundant, but convenient.
This commit is contained in:
Dmitry Bogatov 2024-03-24 11:20:19 -04:00
parent 9ca5ee43d6
commit c1a2eed032
1 changed files with 4 additions and 1 deletions

View File

@ -71,6 +71,9 @@ def init(rev, prefix, url):
sha1 = check_output(
["git", "log", "-n1", "FETCH_HEAD", "--format=%H"], text=True
).strip()
commit_date = check_output(
["git", "log", "-n1", "FETCH_HEAD", "--format=%cI"], text=True
).strip()
# Normalize prefix.
prefix = path.abspath(prefix).removeprefix(path.abspath(".")).strip("/")
@ -93,7 +96,7 @@ def init(rev, prefix, url):
check_call(args)
with statefile() as state:
state[prefix] = dict(url=url, sha1=sha1, rev=rev)
state[prefix] = dict(url=url, sha1=sha1, rev=rev, date=commit_date)
check_call(["git", "add", "git-subtree.json"])
check_call(
["git", "commit", "--amend"],