All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: arjen@yaph.org (Arjen Laarhoven)
Cc: tytso@mit.edu, git@vger.kernel.org
Subject: Re: [PATCH] Teach git-mergetool about Apple's opendiff/FileMerge
Date: Thu, 22 Mar 2007 21:45:09 -0700	[thread overview]
Message-ID: <7vbqiksh4a.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <20070322213728.GD3854@regex.yaph.org> (Arjen Laarhoven's message of "Thu, 22 Mar 2007 22:37:28 +0100")

arjen@yaph.org (Arjen Laarhoven) writes:

> Signed-off-by: Arjen Laarhoven <arjen@yaph.org>

I cannot comment on the calling interface of opendiff, as I do
not have access to an Apple.  Here are my first impressions.

> diff --git a/git-mergetool.sh b/git-mergetool.sh
> index 7942fd0..58ae201 100755
> --- a/git-mergetool.sh
> +++ b/git-mergetool.sh
> @@ -248,6 +248,30 @@ merge_file () {
>  		mv -- "$BACKUP" "$path.orig"
>  	    fi
>  	    ;;
> +	opendiff)
> +	    touch "$BACKUP"
> +	    if base_present; then
> +		opendiff $LOCAL $REMOTE -ancestor $BASE -merge $path | cat
> +            else
> +                opendiff $LOCAL $REMOTE -merge $path | cat
> +            fi

I sense inconsistent tabbing here.

More seriously, all of the above $variable references must be
dq'ed; see other case arms for good examples.

What's the purpose of this cat anyway?  It looks like an
expensive no-op to me.

> +	    if test "$path" -nt "$BACKUP" ; then
> +		status=0;
> +	    else
> +		while true; do
> +		    echo "$path seems unchanged."
> +		    echo -n "Was the merge successful? [y/n] "
> +		    read answer < /dev/tty
> +		    case "$answer" in
> +			y*|Y*) status=0; break ;;
> +			n*|N*) status=1; break ;;
> +		    esac
> +		done
> +	    fi
> +	    if test "$status" -eq 0; then
> +		mv -- "$BACKUP" "$path.orig"
> +	    fi
> +	    ;;
>      esac

This part is duplicated across meld|vimdiff and xxdiff arms; you
probably would want to have a patch that makes a shell function
to factor this out, and then another patch to add this opendiff
support.

  reply	other threads:[~2007-03-23  4:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-22 21:37 [PATCH] Teach git-mergetool about Apple's opendiff/FileMerge Arjen Laarhoven
2007-03-23  4:45 ` Junio C Hamano [this message]
2007-03-23  4:52   ` Steven Grimm
2007-03-23  8:25   ` Arjen Laarhoven
2007-03-23 14:15 ` Theodore Tso
2007-03-23 18:42   ` Marco Roeland
2007-03-29 14:03 ` Theodore Tso

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=7vbqiksh4a.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=arjen@yaph.org \
    --cc=git@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.