From: Junio C Hamano <gitster@pobox.com>
To: Ridil culous <reallyridilculous@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Feature Request: Allow to stash push and pop file modification times to avoid rebuilds
Date: Tue, 21 Mar 2023 14:09:02 -0700 [thread overview]
Message-ID: <xmqq5yathkwh.fsf@gitster.g> (raw)
In-Reply-To: <CAEg4PiL+Y8yxCpWaQFUswTj1qegT084w9m0rc14Kf1dEWk5G-g@mail.gmail.com> (Ridil culous's message of "Tue, 21 Mar 2023 21:46:35 +0100")
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.
next prev parent reply other threads:[~2023-03-21 21:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-21 20:46 Feature Request: Allow to stash push and pop file modification times to avoid rebuilds Ridil culous
2023-03-21 20:59 ` rsbecker
2023-03-22 11:03 ` Ridil culous
2023-03-21 21:09 ` Junio C Hamano [this message]
2023-03-22 11:13 ` Ridil culous
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq5yathkwh.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=reallyridilculous@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).