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

Keeping the file modification date with git

From
RKRonan Keryell <ronan.keryell@hpc-project.com>
Date
Jan 28, 2011, 19:49 UTC
Message-ID
<87bp30vmek.fsf@an-dro.info.enstb.org>

After heavily using git for code development, we plan to use it for administrative storage and I need to keep the modification date of the files.

Since I'm fond of git, I don't want to go back to some other tools I previously used but that keep the modification date... :-)

So I'm envisioning different solutions:
- it is already done. I have missed this. :-) But would be great. :-)
- giving up. Not an option :-)
- it is added to git core functions because it is quite useful for some
  people. Too time-consuming for me since I'm not a git developer... But
  someone else could do this...
- add this concept aside. For example, just as there are .gitignore or
  .gitattributes files, we could have a .gitdates that would store in a
  human-readable manner the modification time of the files in its
  directory.
  A nice side effect is that if we have conflicts on modification times
  during merge, we could just resolve conflict in the date file. :-) Of
  course, having merge tools aware of this could help the user to deal
  with this.
  By the way, we could consider modification time as a special attribute
  in .gitattributes to avoid yet another .git file? But I guess that the
  date information may be huge for a big directory, so it may be better
  to keep in a dedicated sorted file, to be processed efficiently
  without messing .gitattributes
  The implementation could be done with helper functions called from
  various hooks such as:
    - updating the .gitdates could be done in the pre-commit hook so
      that they are added to the commit when needed;
    - when a checkout is done, the date of some files may be update. I
      cannot see any hook for this...
  Well there are many things that should be triggered in the git
  plumbing or the user should have to launch explicitly some helper
  functions (for example to commit only a date change, since from the git
  point of view, nothing has changed and the commit is not done...).
  I have no idea about the execution time we would have on a big
  repository with many files, with a naive implementation to test the
  concept...
Any comments on the different approaches?
Thanks,
-- 
  Ronan KERYELL                      |\/  GSM:    (+33|0) 6 13 14 37 66
  HPC Project                        |/)  Fax:    (+33|0) 1 46 01 05 46
  9 Route du Colonel Marcel Moraine  K    E-mail: rk@hpc-project.com
  92360 Meudon La Forêt              |\   skype:keryell
  FRANCE                             | \  http://hpc-project.com
Next: Jeff King
Message 1 of 2 in “Keeping the file modification date with git”
  1. Ronan KeryellJan 28, 2011
  2. Jeff KingJan 28, 2011

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.