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

Re: Branches & directories

From
Michael Witten <mfwitten@gmail.com>
Date
Aug 23, 2011, 14:46 UTC
Message-ID
<CAMOZ1BvM08FTODUbGhQMqAmVLWY1cQjTcDknGFp3ZGTsH=0fZw@mail.gmail.com>
In-Reply-To
<CAE1pOi1axNmGaPVXqBH02x0N=Z6tgO9R00RTokuJm50eY-OoNg@mail.gmail.com>
On Mon, Aug 22, 2011 at 20:10, Hilco Wijbenga <hilco.wijbenga@gmail.com> wrote:
Show 20 quoted lines
> On 22 August 2011 12:31, Kyle Moffett <kyle@moffetthome.net> wrote:
>> On Mon, Aug 22, 2011 at 14:49, Hilco Wijbenga <hilco.wijbenga@gmail.com> wrote:
>>> On 22 August 2011 05:46, Kyle Moffett <kyle@moffetthome.net> wrote:
>>>> On Mon, Aug 22, 2011 at 01:36, Hilco Wijbenga <hilco.wijbenga@gmail.com> wrote:
>>>>> On 21 August 2011 20:01, Kyle Moffett <kyle@moffetthome.net> wrote:
>>>> In particular, even "git stash" intentionally does not preserve file times,
>>>> so you would end up rebuilding everything anyways because all of your
>>>> source files would be as new as your object files.
>>>
>>> Yes, I just noticed that. Why do you say "intentionally"? Is extra
>>> work being done to make it so? If yes, then shouldn't that be
>>> configurable?
>>
>> Well, there's 2 reasons:
>>
>> (1) The GIT data-structures simply have no place for file timestamps, and
>> "git stash" is simply a special way of dumping files into a temporary commit.
>
> That's what I thought. The "intentionally" threw me off. It's not
> intentional, it's just a side effect.
No, it's intentional.

This discussion about timestamps is not new; the mailing list is littered with people wondering about it. The data structures are the way they are for intentional reasons, as suggested by Kyle's example.

Show 22 quoted lines
>> (2) You almost always *don't* want to preserve timestamps.  For example:
>>
>> $ git checkout -b my-feature origin/master
>> $ vim some-file.c
>> $ make
>> $ git add some-file.c && git commit -m "A new feature"
>> $ git checkout -b my-bugfix origin/master
>> $ vim other-file.c
>> $ make
>>
>> If GIT preserved timestamps, the second "make" would fail to rebuild the
>> product "some-file.o" because "some-file.c" is still older than it, even
>> though "some-file.c" has changed since the last build!!!
>>
>> Really, GIT is only intended for storing source code.  If you want to store
>> other kinds of things (like timestamps, permissions, etc), then you need to
>> turn them into source code (IE: a text file and a "make install" target) and
>> then store them that way.
>
> Yep, that all makes sense. I just wish there was at least an option to
> keep the timestamp (and possibly other such things). Even Subversion
> can do that... ;-) After all, not everybody uses C & make.

Yes, well, the crux there is `(and possibly other such things)'. That is an open-ended specification because nobody can agree on what such things should include.

One of git's major design goals has been efficiency, so it's natural that git only handles what is necessary for its prime purpose of managing a history of line-oriented textual content.

However, other tools have been built on top of git's infrastructure in order to store all manner of metadata (usually for the purposes of backing up files with all of their special metadata).

Essentially, only *you* know what `other such things' *you* need, so it's up to you to design a way of storing such information and retrieving it yourself. After all, not everybody (indeed, nearly nobody, I'd wager) has your specific difficulties.

Previous: Hilco WijbengaNext: Robin Rosenberg
Message 34 of 52 in “Branches & directories”
  1. Hilco WijbengaAug 17, 2011
  2. Evan ShelhamerAug 17, 2011
  3. Junio C HamanoAug 17, 2011
  4. Hilco WijbengaAug 17, 2011
  5. Jonathan NiederAug 18, 2011
  6. Hilco WijbengaAug 21, 2011
  7. Michael WittenAug 18, 2011
  8. Michael J GruberAug 18, 2011
  9. Michael WittenAug 18, 2011
  10. Jonathan NiederAug 19, 2011
  11. Hilco WijbengaAug 21, 2011
  12. Michael WittenAug 21, 2011
  13. Hilco WijbengaAug 21, 2011
  14. Michael WittenAug 21, 2011
  15. Hilco WijbengaAug 21, 2011
  16. Michael WittenAug 22, 2011
  17. Hilco WijbengaAug 22, 2011
  18. Hilco WijbengaAug 22, 2011
  19. Michael WittenAug 22, 2011
  20. Hilco WijbengaAug 22, 2011
  21. Kyle MoffettAug 22, 2011
  22. Hilco WijbengaAug 22, 2011
  23. Kyle MoffettAug 22, 2011
  24. Hilco WijbengaAug 22, 2011
  25. Kyle MoffettAug 22, 2011
  26. Hilco WijbengaAug 22, 2011
  27. Restoring timestamps (Re: Branches & directories)Jonathan Nieder, Aug 22, 2011
  28. Hilco WijbengaAug 22, 2011
  29. Jonathan NiederAug 22, 2011
  30. Hilco WijbengaAug 23, 2011
  31. Hilco WijbengaAug 23, 2011
  32. Enrico WeigeltOct 2, 2011
  33. Hilco WijbengaOct 2, 2011
  34. Michael WittenAug 23, 2011
  35. Robin RosenbergOct 2, 2011
  36. Ronan KeryellOct 2, 2011
  37. Matthieu MoyOct 2, 2011
  38. Hilco WijbengaOct 2, 2011
  39. Hilco WijbengaOct 2, 2011
  40. Jeff KingOct 3, 2011
  41. Hilco WijbengaOct 3, 2011
  42. Jeff KingOct 3, 2011
  43. Matthieu MoyOct 3, 2011
  44. Jeff KingOct 3, 2011
  45. Matthieu MoyOct 3, 2011
  46. Jeff KingOct 3, 2011
  47. Junio C HamanoOct 3, 2011
  48. Jeff KingOct 3, 2011
  49. Hilco WijbengaOct 3, 2011
  50. Robin RosenbergOct 3, 2011
  51. Hilco WijbengaOct 3, 2011
  52. Hilco WijbengaOct 2, 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.