From: Junio C Hamano <junkio@cox.net>
To: Mark Levedahl <mlevedahl@verizon.net>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: autoCRLF, git status, git-gui, what is the desired behavior?
Date: Sun, 25 Feb 2007 12:28:45 -0800 [thread overview]
Message-ID: <7vfy8urngi.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <7vlkimrp1f.fsf@assigned-by-dhcp.cox.net> (Junio C. Hamano's message of "Sun, 25 Feb 2007 11:54:36 -0800")
Junio C Hamano <junkio@cox.net> writes:
> Ah, I know what is going on. "update-index --refresh" notices
> that lstat(2) says the size is different between what is
> recorded in the index, and does not actually compare and refresh
> the entry.
>
> But that is a very important optimization, and I do not think we
> would want to cripple that for autoCRLF.
It might be interesting to try this patch.
Usually we _trust_ the index and say that the path has been
modified if what its length on the filesystem returned by
lstat(2) does not match with what is recorded in the index.
What this patch does is to disable that optimization when
autocrlf is in effect. The change would make all paths whose
size, read by lstat(2) from the filesystem, does not match what
is recorded in the index to be re-validated by comparing the
data, and if it is found not to have been modified, refresh the
index by updating the size information (and other information
such as mtime). In other words, this would probably make it
prohibitibly expensive on autocrlf filesystems if you leave many
paths dirty to run update-index --refresh (hence status and
commit).
diff --git a/read-cache.c b/read-cache.c
index 605b352..11b8b56 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -225,11 +225,15 @@ int ce_modified(struct cache_entry *ce, struct stat *st, int really)
if (changed & (MODE_CHANGED | TYPE_CHANGED))
return changed;
- /* Immediately after read-tree or update-index --cacheinfo,
+ /*
+ * Immediately after read-tree or update-index --cacheinfo,
* the length field is zero. For other cases the ce_size
* should match the SHA1 recorded in the index entry.
+ * However, use of core.autocrlf can screw us up badly.
*/
- if ((changed & DATA_CHANGED) && ce->ce_size != htonl(0))
+ if ((changed & DATA_CHANGED) &&
+ ce->ce_size != htonl(0) &&
+ !auto_crlf)
return changed;
changed_fs = ce_modified_check_fs(ce, st);
next prev parent reply other threads:[~2007-02-25 20:28 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-25 19:33 autoCRLF, git status, git-gui, what is the desired behavior? Mark Levedahl
2007-02-25 19:54 ` Junio C Hamano
2007-02-25 20:28 ` Junio C Hamano [this message]
2007-02-25 21:14 ` Mark Levedahl
2007-02-25 21:22 ` Junio C Hamano
2007-02-25 22:20 ` Mark Levedahl
2007-02-25 23:55 ` Mark Levedahl
2007-02-25 20:51 ` Mark Levedahl
2007-02-26 2:06 ` Shawn O. Pearce
2007-02-26 2:45 ` Junio C Hamano
2007-02-26 15:54 ` Shawn O. Pearce
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=7vfy8urngi.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=git@vger.kernel.org \
--cc=mlevedahl@verizon.net \
/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).