git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Charles Bailey <charles@hashpling.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Hannu Koivisto <azure@iki.fi>,
	Theodore Tso <tytso@mit.edu>
Subject: Re: [PATCH] mergetool: respect autocrlf by using checkout-index
Date: Fri, 23 Jan 2009 18:18:00 +0000	[thread overview]
Message-ID: <20090123181800.GA20177@hashpling.org> (raw)
In-Reply-To: <7v1vuuvt11.fsf@gitster.siamese.dyndns.org>

On Fri, Jan 23, 2009 at 09:20:10AM -0800, Junio C Hamano wrote:
> Charles Bailey <charles@hashpling.org> writes:
> 
> > Previously, git mergetool used cat-file which does not perform git to
> > worktree conversion. This changes mergetool to use git checkout-index
> > instead which means that the temporary files used for mergetool use the
> > correct line endings for the platform.
> >
> > Signed-off-by: Charles Bailey <charles@hashpling.org>
> 
> Sounds like the right thing to do and from a cursory review it looks Ok to
> me.
> 
> But I do not use mergetool myself, so an Ack from Ted and a Thanks from
> whoever reported the breakage would be encouraging ;-).

Yes, please!

I had wondered why I hadn't really noticed about this 'issue' before
as I've used git mergetool on windows with autocrlf set to true quite
a bit. I think that if your mergetool handles LF endings it doesn't
really matter as it's only the temporary files that are affected and
if the mergetool generates LF output files in response to LF input
files then this is resolved to the correct format at the time it is
added to the index in any case.

> > +checkout_staged_file () {
> > +    tmpfile=$(expr "$(git checkout-index --temp --stage="$1" "$2")" : '\([^	]*\)	')
> > +
> > +    if test $? -eq 0 -a -n "$tmpfile" ; then
> > +	mv -- "$tmpfile" "$3"
> 
> The original redirects into the final destination but this moves.  This
> will lose the perm bits of the original and obey the perm bits
> checkout-index gives you.  It will also behave differently when the path
> is a symlink.  These two differences _may_ well be improvements and/or
> bugfixes, but if that is the case please describe them as such.

I hadn't actually thought about the perms thing that much but now that
I do...

This code, and the code that it replaces, only affects the temporary
files that form the basis for the merge. The result/destination file
is as generated by the merge (or rebase).

The redirect version (as is) will not set permissions from the index -
effectively losing information, the new version should (I think - I'm
not an expert in checkout-index) get the 'correct' repository
permissions. I would say that this is, if anything, an improvement.
The ultimate effect really depends on the mergetool and whether the
source file permissions affect the permissions that it sets on the
target file. In the vast majority of cases I would think that it
doesn't have any effect.

Note that symlinks in the repository are not resolved by this code
path so they aren't affected.

-- 
Charles Bailey
http://ccgi.hashpling.plus.com/blog/

  reply	other threads:[~2009-01-23 18:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-21 16:55 git diff, git mergetool and CRLF conversion Hannu Koivisto
2009-01-21 17:23 ` Charles Bailey
2009-01-21 21:03   ` Theodore Tso
2009-01-21 22:57     ` [PATCH] mergetool: respect autocrlf by using checkout-index Charles Bailey
2009-01-23 17:20       ` Junio C Hamano
2009-01-23 18:18         ` Charles Bailey [this message]
2009-01-26 16:15         ` Hannu Koivisto
2009-01-26 16:31           ` Charles Bailey
2009-01-26 21:28             ` Junio C Hamano
2009-01-26 22:08               ` Junio C Hamano
2009-01-26 23:09                 ` Junio C Hamano
2009-01-27 13:58                   ` Hannu Koivisto

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=20090123181800.GA20177@hashpling.org \
    --to=charles@hashpling.org \
    --cc=azure@iki.fi \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=tytso@mit.edu \
    /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).