aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2023-06-21 16:03:07 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2023-06-21 16:03:07 -0400
commit377e02fe2bcd16946b821d3ec2c384192523ee75 (patch)
treea2226894191576888b5e022f2cbd0a51b8c18918
parentd8b835c3644765d8a0db2601cb8a4b0245c1c86b (diff)
downloadb4-377e02fe2bcd16946b821d3ec2c384192523ee75.tar.gz
ez: make message-ids use today's date
When creating the message-id of the series to be sent, we're reusing the change-id, which includes the origin date when that change-id was first created. Change this to today's date in order to be more conforming to how git-send-email does it. Suggested-by: Christian Brauner <brauner@kernel.org> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217359 Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r--b4/ez.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/b4/ez.py b/b4/ez.py
index 7c3190f..ec0fb9d 100644
--- a/b4/ez.py
+++ b/b4/ez.py
@@ -1037,12 +1037,17 @@ def make_msgid_tpt(change_id: str, revision: str, domain: Optional[str] = None)
if myemail:
domain = re.sub(r'^[^@]*@', '', myemail)
else:
- # Use the hostname of the system
- import platform
- domain = platform.node()
+ # Just use "b4" for the domain name (it doesn't need to be anything real)
+ domain = 'b4'
chunks = change_id.rsplit('-', maxsplit=1)
stablepart = chunks[0]
+ # Replace the change-id origin date with current date
+ chunks = stablepart.split('-', maxsplit=1)
+ if len(chunks) == 2 and len(chunks[0]) == 8:
+ # If someone uses b4 in year 10000, look me up.
+ stablepart = '%s-%s' % (datetime.date.today().strftime('%Y%m%d'), chunks[1])
+
# Message-IDs must not be predictable to avoid stuffing attacks
randompart = uuid.uuid4().hex[:12]
msgid_tpt = f'<{stablepart}-v{revision}-%s-{randompart}@{domain}>'