git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	git@vger.kernel.org, Sebastian Schuberth <sschuberth@gmail.com>
Subject: Re: [PATCH] Respect core.autocrlf when preparing temporary files for external diff
Date: Sun, 22 Mar 2009 00:18:33 -0700	[thread overview]
Message-ID: <7v63i281py.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20090322061046.GA14765@coredump.intra.peff.net> (Jeff King's message of "Sun, 22 Mar 2009 02:10:46 -0400")

Jeff King <peff@peff.net> writes:

> ...how expensive is the check for convert_to_working_tree? It should
> just be a gitattributes lookup, shouldn't it? Which:
>
>   a. we are doing anyway and caching
>
>   b. which takes a fraction of a second (try "time git ls-files | git
>      check-attr --stdin diff >/dev/null", which should give a
>      worst-case).

Ok.  Although I already queued the removal to 'pu' for tonight's pushout
and it is way too late to revert that, I think I didn't have to remove the
function.  The codepath that lets you cheat by borrowing from the checkout
runs convert_to_git() when it borrows, and if you are seeing a meaningful
optimization even with that overhead, perhaps it would be worth keeping.

There is another check that should be there but is missing from the
current implementation of reuse_worktree_file(), other than the "is
convert_to_working_tree() a no-op for this path?" check.  The last check
in the function would say "Yeah, we can reuse it" if the ce is marked
"assume unchanged"; we do not want to blindly reuse the file from the work
tree in that case.

> Anyway, I was planning to make a patch to always feed textconv the
> _clean_ version of each file. My thinking was:
>
>   1. Then tools get a consistent view of the data across platforms.
>      I.e., my textconv munger or external diff script will work no
>      matter what you think the working tree should look like.
>
>   2. The tool may want the clean version, or it may want the smudged
>      version. Or it may be able to operate on either. If we give it a
>      format it doesn't like, it will have to undo whatever we did.
>
>      For most cases, we start with the clean file (i.e., from a tree or
>      from the index).  If we hand out the clean file and the script
>      doesn't like it, it pays the cost to smudge once. If we hand it the
>      smudged file and the script doesn't like it, we pay the cost to
>      smudge _and_ the script pays the cost to clean.

While the purist in me says #1 above is the right argument to make for
feeding "clean" version, I suspect that the textconv or extdiff tools more
often are not made from scratch and ported across platforms than are
cobbled up together out of tools the script writer finds on his platform.
I suspect that Dscho's "a tempfile should look like a checkout" would be
much friendlier to them in practice for this reason.

> For some reason, with your patch the tempfiles are created with mode
> 0005 for me (whereas they are usually 0505), which makes open() in the
> called script unhappy.  Looking over the patch text, though, I have no
> idea what change could be causing that.

Neither 0005 nor 0505 sounds correct to me; shouldn't they be 0600 or
something like that?

  reply	other threads:[~2009-03-22  7:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1237635609u.git.johannes.schindelin@gmx.de>
2009-03-21 11:42 ` [PATCH] Respect core.autocrlf when preparing temporary files for external diff Johannes Schindelin
2009-03-21 17:02   ` Michael J Gruber
2009-03-21 19:35   ` Junio C Hamano
2009-03-21 23:54     ` Johannes Schindelin
2009-03-22  0:03       ` Junio C Hamano
2009-03-22  0:41         ` Junio C Hamano
2009-03-22  6:10           ` Jeff King
2009-03-22  7:18             ` Junio C Hamano [this message]
2009-03-22  7:46               ` Jeff King
2009-03-22 15:30                 ` Sebastian Schuberth
2009-03-22 21:59                   ` Junio C Hamano
2009-03-22 22:48                     ` Sebastian Schuberth
2009-03-22 23:12                       ` Junio C Hamano
2009-03-23  0:39                 ` Junio C Hamano

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=7v63i281py.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --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).