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

Re: Feature Request: Allow to stash push and pop file modification times to avoid rebuilds

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 21, 2023, 21:09 UTC
Message-ID
<xmqq5yathkwh.fsf@gitster.g>
In-Reply-To
<CAEg4PiL+Y8yxCpWaQFUswTj1qegT084w9m0rc14Kf1dEWk5G-g@mail.gmail.com>
Ridil culous <reallyridilculous@gmail.com> writes:
> "git stash push"
> later followed by
> "git stash pop"
> does restore files but doesn't restore file modification times.

It is very consistent with everything Git (the version control system) does to working tree files, e.g. "git restore -- file", "git switch branch". Like it or not, build systems that avoids recomputation of material derived from source files (which are kept in the version control systems, like Git) often work by comparing file timestamps.

Imagine that you had iffy changes in the working tree files, and then did a build. The build artifacts are based on the souce with those iffy changes. Then you do "stash push" to tentatively remove the changes. Perhaps you make a build again. You want your new build artifacts to reflect the fact that you no longer have those iffy changes in the source, so "stash push" should update the file timestamp when it removes the changes. Now you would do "stash pop", because you are convinced that those changes that you earlier thought were iffy are indeed good ones.

Now what timestamp should "stash pop" give to the working tree files in this case? The contents of the file probably is identical to the timestamp of the working tree files immediately before "stash push" was run. If we restore the original timestamp, because it is way older than the build artifacts of your second build (which was done after "stash push"), the build artifacts would not be recreated. The source has those changes (that used to be deemed iffy but now they are OK), the build artifact does not.

Unless your build system bases its rebuilding decisions on the contents, not timestamps, it is very much essential not to artificially muck with the file timestamp when your source control system rewrites the files in your working tree to avoid broken builds, I would have to say.

Previous: Ridil culousNext: Ridil culous
Message 4 of 5 in “Feature Request: Allow to stash push and pop file modification times to avoid rebuilds”
  1. Ridil culousMar 21, 2023
  2. rsbecker@nexbridge.comMar 21, 2023
  3. Ridil culousMar 22, 2023
  4. Junio C HamanoMar 21, 2023
  5. Ridil culousMar 22, 2023

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.