From: Junio C Hamano <gitster@pobox.com>
To: Karsten Blees <karsten.blees@gmail.com>
Cc: "Konstantin Khomoutov" <kostix+git@007spb.ru>,
"Konrád Lőrinczi" <klorinczi@gmail.com>,
"Sebastian Schuberth" <sschuberth@gmail.com>,
git@vger.kernel.org
Subject: Re: Git doesn't detect change, if file modification time is restored to original one
Date: Thu, 23 Jul 2015 10:32:31 -0700 [thread overview]
Message-ID: <xmqqsi8epyog.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <55B1053D.7030006@gmail.com> (Karsten Blees's message of "Thu, 23 Jul 2015 17:16:13 +0200")
Karsten Blees <karsten.blees@gmail.com> writes:
> I'd like to add that this is not a git-specific problem: resetting mtime
> on purpose will fool lots of programs, including backup software, file
> synchronization tools (rsync, xcopy /D), build systems (make), and web
> servers / proxies (If-Modified-Since requests).
>
> So you would typically reset mtime if you *want* programs to ignore the
> changes.
Yup. Nicely phrased.
When you run a wholesale rewrite of many files, often you find that
some (or many) of the files did not have to be modified. E.g.
"perl -i -e 's/old/new/' *" may want to touch all files, but the
files that did not have string 'old' in them would have the same
contents as before. In such a case, you can avoid unnecessary
reinspection of contents (e.g. recompilation) by many tools that pay
attention to mtime to see if contents changed by reverting mtime to
the original for files that did not change.
Git also pays attention to fields other than mtime, so after
perl -i -e 's/old/ancient/' *
and reverting mtime even for ones that got changed, we should notice
the changes. But you are correct that such an abuse of "touch" will
break many other tools.
next prev parent reply other threads:[~2015-07-23 17:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-23 7:29 Git doesn't detect change, if file modification time is restored to original one Konrád Lőrinczi
2015-07-23 7:58 ` Sebastian Schuberth
2015-07-23 9:14 ` Konrád Lőrinczi
2015-07-23 14:53 ` Konstantin Khomoutov
2015-07-23 15:16 ` Karsten Blees
2015-07-23 17:32 ` Junio C Hamano [this message]
2015-07-23 14:17 ` Johannes Schindelin
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=xmqqsi8epyog.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=karsten.blees@gmail.com \
--cc=klorinczi@gmail.com \
--cc=kostix+git@007spb.ru \
--cc=sschuberth@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).