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

Re: Git checkout preserve timestamp?

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Mar 5, 2007, 22:56 UTC
Message-ID
<Pine.LNX.4.63.0703052339050.22628@wbgn013.biozentrum.uni-wuerzburg.de>
In-Reply-To
<17900.39124.763603.695942@lisa.zopyra.com>
Hi,
On Mon, 5 Mar 2007, Bill Lear wrote:
Show 16 quoted lines
> On Monday, March 5, 2007 at 13:50:45 (-0800) Linus Torvalds writes:
> >On Mon, 5 Mar 2007, Bill Lear wrote:
> >> 
> >> Not because git wrote the file, but because git notices that content
> >> changes, and writes the file (and timestamps it) "smartly".  If
> >> someone writes into the repo, the timestamp stored becomes invalidated
> >> and the write of the file just creates the timestamp at the time of
> >> the checkout.  If no write into the repo index occurs, the stored
> >> timestamp is applied after the file is checked out.
> >
> >But Bill, don't you realize that restoring the timestamp is *WRONG*?
> 
> Maybe, maybe not.  Each argument I've seen doesn't convince me.  Sure,
> it may be MESSY.  It may be UGLY, and therefore undesirable, but I
> don't think any of the arguments have conclusively shown that it
> is WRONG or INFEASIBLE in any way.
It may not be infeasible.

But it is wrong. It "fixes" a totallc clear idiom, namely that every time a file is written into, the timestamp changes. And guess what, "touch <file>" is the best proof that sometimes, you want that this happens, even if the content stays the same.

> If someone pushes into my repo, as Johannes suggested (how that would 
> work, being a non-bare repo, is beyond me, but whatever),

Of course this works. That is a fundamental feature of Git: if you strip a non-bare repo of its working directory, then it becomes a bare repo.

> the timestamp for that file on that branch would be invalidated, and the 
> file would get whatever timestamp it got when it was written to disk.

This approach is so fragile! It is invasive, easy to get wrong (count the ways how to invalidate the timestamp), and serves only an obscure use case, which is better solved otherwise to begin with.

> >So stop even asking for this. We'd have to be totally and utterly 
> >incompetent to do what you ask for. We're simply not that stupid. 

FWIW I have to agree here. I saw quite a few projects go wrong, because management insisted on abolishing a perfectly good design, just because they had this pet idea.

Show 12 quoted lines
> >We already pointed out how you can do what you want to do *other* ways 
> >that are *not* idiotic and incompetent. I don't think you even 
> >answered.
> 
> I am not asking for this, I'm just arguing the point, waiting for a
> convincing argument rather than having someone call me "idiotic and
> incompetent" and "stupid" for asking for it in the first place and
> carrying on in the spirit of discovery and open learning.
> 
> For your information, I did in fact answer, politely, thanking the
> poster for pointing our hash-based "stamps" that could do this sort of
> thing.

No. This is not what Linus was referring to (unless I am really wrong here, which I refuse to believe).

We pointed out, in several ways, how much easier it is to create a throw-away working directory.

It is easy, robust, and can be done _right now_ with Git.

Ciao, Dscho

Previous: Matthieu MoyNext: Bill Lear
Message 41 of 51 in “Git checkout preserve timestamp?”
  1. Bill LearMar 1, 2007
  2. Alex RiesenMar 1, 2007
  3. Johannes SchindelinMar 1, 2007
  4. Linus TorvaldsMar 1, 2007
  5. Johannes SchindelinMar 1, 2007
  6. Karl HasselströmMar 2, 2007
  7. Bill LearMar 2, 2007
  8. Bart TrojanowskiMar 2, 2007
  9. Johannes SchindelinMar 2, 2007
  10. Karl HasselströmMar 2, 2007
  11. Johannes SchindelinMar 2, 2007
  12. Karl HasselströmMar 5, 2007
  13. Johannes SchindelinMar 5, 2007
  14. Karl HasselströmMar 5, 2007
  15. Bill LearMar 5, 2007
  16. Johannes SchindelinMar 5, 2007
  17. Bill LearMar 5, 2007
  18. Johannes SchindelinMar 5, 2007
  19. Bill LearMar 5, 2007
  20. Linus TorvaldsMar 5, 2007
  21. Matthieu MoyMar 5, 2007
  22. Bill LearMar 5, 2007
  23. Linus TorvaldsMar 5, 2007
  24. Bill LearMar 5, 2007
  25. Johannes SchindelinMar 5, 2007
  26. Bill LearMar 5, 2007
  27. Johannes SchindelinMar 5, 2007
  28. Michael PooleMar 6, 2007
  29. Johannes SchindelinMar 6, 2007
  30. Michael PooleMar 6, 2007
  31. Johannes SchindelinMar 6, 2007
  32. Junio C HamanoMar 6, 2007
  33. Sergio CallegariMar 6, 2007
  34. Jakub NarebskiMar 6, 2007
  35. Bill LearMar 6, 2007
  36. Johannes SchindelinMar 6, 2007
  37. Bill LearMar 6, 2007
  38. Martin LanghoffMar 6, 2007
  39. Theodore TsoMar 6, 2007
  40. Matthieu MoyMar 5, 2007
  41. Johannes SchindelinMar 5, 2007
  42. Bill LearMar 5, 2007
  43. Johannes SchindelinMar 5, 2007
  44. Bill LearMar 5, 2007
  45. Andy ParkinsMar 5, 2007
  46. Karl HasselströmMar 5, 2007
  47. Andy ParkinsMar 5, 2007
  48. Karl HasselströmMar 5, 2007
  49. Bill LearMar 5, 2007
  50. Andy ParkinsMar 5, 2007
  51. Bill LearMar 5, 2007

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.