From: Junio C Hamano Date: Fri, 23 Jan 2009 17:20:10 GMT Subject: Re: [PATCH] mergetool: respect autocrlf by using checkout-index Message-ID: <7v1vuuvt11.fsf@gitster.siamese.dyndns.org> In-Reply-To: <1232578668-2203-1-git-send-email-charles@hashpling.org> Charles Bailey 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 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 ;-). > +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.