From: Andy Parkins <andyparkins@gmail.com>
To: git@vger.kernel.org
Cc: "Karl Hasselström" <kha@treskal.com>,
"Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
"Bill Lear" <rael@zopyra.com>
Subject: Re: Git checkout preserve timestamp?
Date: Mon, 5 Mar 2007 12:13:50 +0000 [thread overview]
Message-ID: <200703051213.52513.andyparkins@gmail.com> (raw)
In-Reply-To: <20070302162136.GA9593@diana.vm.bytemark.co.uk>
On Friday 2007 March 02 16:21, Karl Hasselström wrote:
> However, given that your file timestamps have been bumped (without
> file content changes), it's a performance bug in your make tool if
Actually, git is as good as it could reasonably get in this regard.
Let's say you did this:
git checkout branch1
git checkout branch2
git checkout branch1
Git will only touch the timestamps of files that are different between the
branches. If the same file is in both branches, then that one remains
untouched in your working tree (it's tricks like this that make git so
blindingly fast).
The fact that you've changed back from branch2 to branch1 is the bone of
contention - how is git meant to know that you haven't done a compilation
while you were on branch2 and hence changed the files that untracked files
depend on? The /only/ sane thing it can do is, in both cases, update changed
files to have the current time.
Perhaps an example would make it clearer:
git checkout branch1
# sourcefile.c changes, so git touches the timestamp
# make would rebuild sourcefile.o
git checkout branch2
# sourcefile.c changes, so git touches the timestamp
# make would rebuild sourcefile.o
git checkout branch1
# sourcefile.c changes, so git touches the timestamp
# make would rebuild sourcefile.o
That's all exactly right, make knows in each case the the ".o" file is out of
date because it has a timestamp earlier than sourcefile.c
Now take the suggestion that timestamps from the repository version should be
restored and do the same thing:
git checkout branch1
# sourcefile.c changes, git sets the timestamp to $timestamp1
# make would rebuild sourcefile.o (setting its timestamp to $now)
git checkout branch2
# sourcefile.c changes, so sets the timestamp to $timestamp2
# make wouldn't rebuild sourcefile.o because $timestamp2 < $now
git checkout branch1
# sourcefile.c changes, so git sets the timestamp to $timestamp1
# make wouldn't rebuild sourcefile.o because $timestamp1 < $now
All very wrong; in two out of the three builds, the wrong sourcefile.o ends up
in the final object.
What git does now is absolutely the right thing. It keeps unnecessary
rebuilds to the safest minimum.
Andy
--
Dr Andy Parkins, M Eng (hons), MIET
andyparkins@gmail.com
next prev parent reply other threads:[~2007-03-05 12:14 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-01 21:36 Git checkout preserve timestamp? Bill Lear
2007-03-01 21:48 ` Alex Riesen
2007-03-01 22:13 ` Johannes Schindelin
2007-03-01 22:25 ` Linus Torvalds
2007-03-01 22:32 ` Johannes Schindelin
2007-03-02 9:14 ` Karl Hasselström
2007-03-02 13:24 ` Bill Lear
2007-03-02 15:01 ` Bart Trojanowski
2007-03-02 15:18 ` Johannes Schindelin
2007-03-02 16:21 ` Karl Hasselström
2007-03-02 19:21 ` Johannes Schindelin
2007-03-05 7:23 ` Karl Hasselström
2007-03-05 11:32 ` Johannes Schindelin
2007-03-05 12:28 ` Karl Hasselström
2007-03-05 19:04 ` Bill Lear
2007-03-05 19:16 ` Johannes Schindelin
2007-03-05 19:59 ` Bill Lear
2007-03-05 20:44 ` Johannes Schindelin
2007-03-05 21:42 ` Bill Lear
2007-03-05 21:50 ` Linus Torvalds
2007-03-05 22:03 ` Matthieu Moy
2007-03-05 22:25 ` Bill Lear
2007-03-05 22:37 ` Linus Torvalds
2007-03-05 23:20 ` Bill Lear
2007-03-05 23:32 ` Johannes Schindelin
2007-03-05 23:38 ` Bill Lear
2007-03-05 23:50 ` Johannes Schindelin
2007-03-06 0:06 ` Michael Poole
2007-03-06 0:20 ` Johannes Schindelin
2007-03-06 0:37 ` Michael Poole
2007-03-06 1:40 ` Johannes Schindelin
2007-03-06 0:32 ` Junio C Hamano
2007-03-06 18:39 ` Sergio Callegari
[not found] ` <7vo dn7w6rz.fsf@assigned-by-dhcp.cox.net>
2007-03-06 1:21 ` Jakub Narebski
2007-03-06 0:24 ` Bill Lear
2007-03-06 1:34 ` Johannes Schindelin
2007-03-06 1:59 ` Bill Lear
2007-03-06 0:06 ` Martin Langhoff
2007-03-06 0:21 ` Theodore Tso
2007-03-05 22:39 ` Matthieu Moy
2007-03-05 22:56 ` Johannes Schindelin
2007-03-05 23:27 ` Bill Lear
2007-03-05 22:02 ` Johannes Schindelin
2007-03-05 22:29 ` Bill Lear
2007-03-05 12:13 ` Andy Parkins [this message]
2007-03-05 12:33 ` Karl Hasselström
2007-03-05 13:19 ` Andy Parkins
2007-03-05 14:53 ` Karl Hasselström
2007-03-05 14:46 ` Bill Lear
2007-03-05 16:01 ` Andy Parkins
2007-03-05 16:28 ` Bill Lear
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=200703051213.52513.andyparkins@gmail.com \
--to=andyparkins@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=kha@treskal.com \
--cc=rael@zopyra.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.