git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Git should preserve modification times at least on request

From
DFDerek Fawcus <dfawcus+lists-git@employees.org>
Date
Feb 22, 2018, 23:24 UTC
Message-ID
<20180222232411.GA54558@accordion.employees.org>
In-Reply-To
<87a7w2ezeq.fsf@evledraar.gmail.com>
On Wed, Feb 21, 2018 at 11:44:13PM +0100, Ævar Arnfjörð Bjarmason wrote:
Show 9 quoted lines
> On Wed, Feb 21 2018, Peter Backes jotted:
> > On Wed, Feb 21, 2018 at 10:33:05PM +0100, Ævar Arnfjörð Bjarmason wrote:
> >> This sounds like a sensible job for a git import tool, i.e. import a
> >> target directory into git, and instead of 'git add'-ing the whole thing
> >> it would look at the mtimes, sort files by mtime, then add them in order
> >> and only commit those files that had the same mtime in the same commit
> >> (or within some boundary).
> >
> > I think that this would be The Wrong Thing to do.
Agreed, but probably for a different reason.
> I'm merely pointing out that if you have the use-case Derek Fawcus
> describes you can get per-file mtimes via something similar to the the
> hook method Theodore Ts'o described today with a simple import tool with
> no changes to git or its object format required.

Actually, I was not proposing any change to the git objects. I was simply suggesting a case where I'd have found a optional mechanism for mtime restoration useful.

What would be useful is a better version of the hook based scheme which Ted mentioned. The import could be via a wrapper script, but checkouts would have to be via a hook such that the original timestamps could then be applied; and those stamps would have to be part of the tar-file commit.

The idea of automatically generating a bunch of commits in time order would be the wrong thing here. That is because one file could well contain changes from more than one logical commit (as guided by the Changelog), and that one logical commit can be spread across a few files with diffrent mode time, one has to manually tease those apart.

So here the purpose behind restoring the timestamps is as an aid in guiding the examination of files to find the changes referenced in the Changelog.

Git is quite useful for this sort of effort, as once a sensible commit has been synthsized, rebase of the next tar-file commit then helps reveal the next set of changes.

So what I'm thinking of is for stuff like this: https://github.com/DoctorWkt/unix-jun72 (and the other repros there), where one wishes to figure out and regenerate a history of changes. Since git is quite useful for representing the end result, it is just that other scripting may make it easier to use for such cases.

DF
Previous: 'Peter Backes'Next: Konstantin Khomoutov
Message 27 of 28 in “Git should preserve modification times at least on request”
  1. Peter BackesFeb 19, 2018
  2. Johannes SchindelinFeb 19, 2018
  3. Peter BackesFeb 19, 2018
  4. Theodore Ts'oFeb 20, 2018
  5. Johannes SchindelinFeb 20, 2018
  6. Peter BackesFeb 20, 2018
  7. Peter BackesFeb 20, 2018
  8. Johannes SchindelinFeb 20, 2018
  9. Peter BackesFeb 20, 2018
  10. Phillip WoodFeb 21, 2018
  11. Randall S. BeckerFeb 19, 2018
  12. Hilco WijbengaFeb 19, 2018
  13. Hilco WijbengaFeb 20, 2018
  14. Jeff KingFeb 20, 2018
  15. Peter BackesFeb 20, 2018
  16. Jacob KellerFeb 21, 2018
  17. Junio C HamanoFeb 20, 2018
  18. Derek FawcusFeb 21, 2018
  19. Ævar Arnfjörð BjarmasonFeb 21, 2018
  20. Peter BackesFeb 21, 2018
  21. Ævar Arnfjörð BjarmasonFeb 21, 2018
  22. Peter BackesFeb 21, 2018
  23. Randall S. BeckerFeb 21, 2018
  24. 'Peter Backes'Feb 22, 2018
  25. Andreas KreyFeb 26, 2018
  26. 'Peter Backes'Feb 26, 2018
  27. Derek FawcusFeb 22, 2018
  28. Konstantin KhomoutovFeb 23, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.