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