From: Junio C Hamano <gitster@pobox.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: git@vger.kernel.org
Subject: Re: An interaction with ce_match_stat_basic() and autocrlf
Date: Wed, 09 Jan 2008 18:11:31 -0800 [thread overview]
Message-ID: <7vzlvea0q4.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: alpine.LFD.1.00.0801080748080.3148@woody.linux-foundation.org
Linus Torvalds <torvalds@linux-foundation.org> writes:
> This patch should fix it, but I suspect we should think hard about that
> change to ie_modified(), and see what the performance issues are (ie that
> code has tried to avoid doing the more expensive ce_modified_check_fs()
> for a reason).
>
> The change to diff.c is similarly interesting. It is logically wrong to
> use the worktree_file there (since we have to read the object anyway), but
> since "reuse_worktree_file" is also tied into the whole refresh logic, I
> think the diff.c change is correct.
>
> I dunno. This is not meant to be applied, it is meant to be thought about.
There are a few cases around the changing value of autocrlf (and
filter attributes --- anything that affects convert_to_git() and
convert_to_working_tree()).
* The cached stat information matches the work tree, but user
changed convert_to_working_tree(). "git diff" reports
nothing. The user needs to remove the work tree file and
check it out again.
* The cached stat information matches the work tree, but user
changed convert_to_git(). Again, diff reports nothing. The
user needs to "git add" to cause rehashing.
* The cached stat information does not match. What the working
tree file stores hasn't changed, but convert_to_git() was
changed.
The fact that the working tree "file" contents did not change
does not have much significance in this case. What defines
the "contents" as far as git is concerned is the combination
of the working tree file contents _and_ what convert_to_git()
does to it.
Depending on the nature of the change to convert_to_git(),
"git diff-files" may or may not report real changes in this
case.
* The working tree file has changed, and convert_to_git() also
has changed.
Depending on the nature of the change to convert_to_git(),
"git diff" may or may not report change in this case. The
most extreme case is when unix2dos is run on the working tree
file and convert_to_git() is made to strip CR. The object
registered in the index won't change in this case.
But in practice, the most problematic case also falls into
this category. The user has _real_ changes to the work tree
file, but at the same time flipped convert_to_git() to
operate differently from before. Users should not be making
such a change, not because of git, but because a commit like
that will be impossible to review (and understand three
months later while archaeologying).
The ie_modified() change you suggested will not be hurt by the
first two cases (which I see are one-shot events and re-checkout
and re-add are good enough solution to them, and I do not want
them to hurt the performance for normal use cases).
I originally thought it was a _bug_, but I suspect the false
positive changes reported by "git diff" is even a good thing.
next prev parent reply other threads:[~2008-01-10 2:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-08 12:12 An interaction with ce_match_stat_basic() and autocrlf Junio C Hamano
2008-01-08 16:10 ` Linus Torvalds
2008-01-08 18:04 ` Junio C Hamano
2008-01-10 2:11 ` Junio C Hamano [this message]
2008-01-08 17:12 ` Pēteris Kļaviņš
2008-01-08 17:30 ` Linus Torvalds
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=7vzlvea0q4.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/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).