fork-dev / TrackerWin

Bug and issue tracker for Fork for Windows
459 stars 10 forks source link

Patch files contain very old date #2069

Closed TCFox closed 9 months ago

TCFox commented 9 months ago

In the Windows version of Fork (1.88.2.0), right-clicking on a commit in the "All Commits" view and selecting "Save as Patch..." results in a file that starts with the following line:

From 2cf7a9f6078498198d999b54c55fd407182c64f9 Mon Sep 17 00:00:00 2001
From: Committer Name <email@example.com>
Date: Wed, 8 Nov 2023 13:25:11 +1300
Subject: [PATCH] Commit Message

The date on the first line looks incredibly incorrect! It does not seem to affect patch files in an adverse way so I suspect this is largely a non-issue, but still a bug.

Note that I am from New Zealand, where our timezone is currently UTC+1300. If you're unable to reproduce this issue, it may be a timezone-related problem.

_(Fun but probably unrelated sidenote: a small but surprising amount of third-party libraries take a shortcut when calculating dates by assuming that midday at UTC+0 results in the same dd/MM/yyyy no matter where you are in the world and which timezone you are in. This tends to cause time-related code to freak out when our timezone dips outside the +/- 12 hours required for that to work. Unlikely to be an issue here, but timezones are weird in New Zealand for reasons like this!)_

DanPristupov commented 9 months ago

The date on the first line looks incredibly incorrect! It does not seem to affect patch files in an adverse way so I suspect this is largely a non-issue, but still a bug.

You will be surprised, but this is documented behavior :).

https://git-scm.com/docs/git-format-patch#_description

A "message" generated by the command consists of three parts:

A brief metadata header that begins with From with a fixed Mon Sep 17 00:00:00 2001 datestamp to help programs like "file(1)" to recognize that the file is an output from this command, fields that record the author identity, the author date, and the title of the change (taken from the first paragraph of the commit log message).

DanPristupov commented 9 months ago

Of course, I didn't know that either. At first I was confused that my patches also have Mon Sep 17 00:00:00 2001 header even though I'm not from New Zealand. Then I started investigating, opened the docs, searched for Sep 17 and found a match at the very beginning :).