git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Added mergetool.kdiff3.doubledash config option
@ 2008-06-12 19:55 Patrick Higgins
  2008-06-12 20:36 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Patrick Higgins @ 2008-06-12 19:55 UTC (permalink / raw)
  To: git; +Cc: gitster, Patrick Higgins

Qt-only builds of kdiff3 (no KDE) do not support a bare '--' on the command
line. It will fail silently and mysteriously.

Signed-off-by: Patrick Higgins <patrick.higgins@cexp.com>
---
 Documentation/config.txt |    6 ++++++
 git-mergetool.sh         |   11 +++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 5331b45..da40c2e 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -884,6 +884,12 @@ mergetool.<tool>.trustExitCode::
 	if the file has been updated, otherwise the user is prompted to
 	indicate the success of the merge.
 
+mergetool.kdiff3.doubledash::
+	A boolean to indicate whether or not your kdiff3 supports a '--'
+	on the command line to separate options from filenames. If you
+	built it without KDE, it probably doesn't have this support and
+	you	should set this to false.  Defaults to true.
+
 mergetool.keepBackup::
 	After performing a merge, the original file with conflict markers
 	can be saved as a file with a `.orig` extension.  If this variable
diff --git a/git-mergetool.sh b/git-mergetool.sh
index fcdec4a..57cbac0 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -181,12 +181,19 @@ merge_file () {
 
     case "$merge_tool" in
 	kdiff3)
+	    doubledash=`git config --bool mergetool.kdiff3.doubledash`
+	    if test "$doubledash" = "false"; then
+		double_dash=""
+	    else
+		double_dash="--"
+	    fi
+
 	    if base_present ; then
 		("$merge_tool_path" --auto --L1 "$MERGED (Base)" --L2 "$MERGED (Local)" --L3 "$MERGED (Remote)" \
-		    -o "$MERGED" -- "$BASE" "$LOCAL" "$REMOTE" > /dev/null 2>&1)
+		    -o "$MERGED" $double_dash "$BASE" "$LOCAL" "$REMOTE" > /dev/null 2>&1)
 	    else
 		("$merge_tool_path" --auto --L1 "$MERGED (Local)" --L2 "$MERGED (Remote)" \
-		    -o "$MERGED" -- "$LOCAL" "$REMOTE" > /dev/null 2>&1)
+		    -o "$MERGED" $double_dash "$LOCAL" "$REMOTE" > /dev/null 2>&1)
 	    fi
 	    status=$?
 	    ;;
-- 
1.5.6.rc2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] Added mergetool.kdiff3.doubledash config option
  2008-06-12 19:55 [PATCH] Added mergetool.kdiff3.doubledash config option Patrick Higgins
@ 2008-06-12 20:36 ` Junio C Hamano
  2008-06-12 22:44   ` Patrick.Higgins
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2008-06-12 20:36 UTC (permalink / raw)
  To: Patrick Higgins; +Cc: git, Theodore Ts'o

Patrick Higgins <patrick.higgins@cexp.com> writes:

> Qt-only builds of kdiff3 (no KDE) do not support a bare '--' on the command
> line. It will fail silently and mysteriously.
>
> Signed-off-by: Patrick Higgins <patrick.higgins@cexp.com>

Hmm, I am seeing this patch for the first time, I have not seen any
discussion history leading to the patch, and I have not been primarily
involved in mergetool.  I'll Cc Ted to see what he thinks...

> +mergetool.kdiff3.doubledash::
> +	A boolean to indicate whether or not your kdiff3 supports a '--'
> +	on the command line to separate options from filenames. If you
> +	built it without KDE, it probably doesn't have this support and
> +	you	should set this to false.  Defaults to true.

The above description makes it clear that there is an issue that needs to
be addressed.  I however am wondering if this can be either autodetected
at runtime, or if it can't, the user should be able to specify the option
when the user runs mergetool from the command line.  It would be necessary
to countermand whichever choice you configured in your config when you
need to run kdiff3 with KDE from one machine and the one without from
another machine, wouldn't it?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] Added mergetool.kdiff3.doubledash config option
  2008-06-12 20:36 ` Junio C Hamano
@ 2008-06-12 22:44   ` Patrick.Higgins
  2008-06-13 14:58     ` Theodore Tso
  0 siblings, 1 reply; 6+ messages in thread
From: Patrick.Higgins @ 2008-06-12 22:44 UTC (permalink / raw)
  To: gitster; +Cc: git, tytso

From: Junio C Hamano [mailto:gitster@pobox.com]

> Patrick Higgins <patrick.higgins@cexp.com> writes:
> 
> > +mergetool.kdiff3.doubledash::
> > +	A boolean to indicate whether or not your kdiff3 supports a '--'
> > +	on the command line to separate options from filenames. If you
> > +	built it without KDE, it probably doesn't have this support and
> > +	you	should set this to false.  Defaults to true.
> 
> The above description makes it clear that there is an issue 
> that needs to
> be addressed.  I however am wondering if this can be either 
> autodetected
> at runtime, or if it can't, the user should be able to 
> specify the option
> when the user runs mergetool from the command line.  It would 
> be necessary
> to countermand whichever choice you configured in your config when you
> need to run kdiff3 with KDE from one machine and the one without from
> another machine, wouldn't it?

I have found the following to be a way to distinguish the two versions based solely on exit status. The broken one exits with 255.

kdiff3 --auto -o /dev/null -- /dev/null /dev/null

I'll work up another patch that uses this. This check adds about 0.5s overhead. That seems a little high to me, but given that mergetool is interactive, I guess that could be acceptable.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Added mergetool.kdiff3.doubledash config option
  2008-06-12 22:44   ` Patrick.Higgins
@ 2008-06-13 14:58     ` Theodore Tso
  2008-06-14  6:17       ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Theodore Tso @ 2008-06-13 14:58 UTC (permalink / raw)
  To: Patrick.Higgins; +Cc: gitster, git

On Thu, Jun 12, 2008 at 04:44:03PM -0600, Patrick.Higgins@cexp.com wrote:
> I have found the following to be a way to distinguish the two
> versions based solely on exit status. The broken one exits with 255.
> 
> kdiff3 --auto -o /dev/null -- /dev/null /dev/null
> 
> I'll work up another patch that uses this. This check adds about
> 0.5s overhead. That seems a little high to me, but given that
> mergetool is interactive, I guess that could be acceptable.

Hmm, do we have a policy about whether or not it is acceptable to
modify .gitconfig behind the user's back?  It would be nice if the
check would be done once and then the result gets cached.  So if not
in .gitconfig, maybe somewhere else.

      	       	    	     	      - Ted

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Added mergetool.kdiff3.doubledash config option
  2008-06-13 14:58     ` Theodore Tso
@ 2008-06-14  6:17       ` Junio C Hamano
  2008-06-14  6:29         ` Theodore Tso
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2008-06-14  6:17 UTC (permalink / raw)
  To: Theodore Tso; +Cc: Patrick.Higgins, gitster, git

Theodore Tso <tytso@mit.edu> writes:

> On Thu, Jun 12, 2008 at 04:44:03PM -0600, Patrick.Higgins@cexp.com wrote:
>> I have found the following to be a way to distinguish the two
>> versions based solely on exit status. The broken one exits with 255.
>> 
>> kdiff3 --auto -o /dev/null -- /dev/null /dev/null
>> 
>> I'll work up another patch that uses this. This check adds about
>> 0.5s overhead. That seems a little high to me, but given that
>> mergetool is interactive, I guess that could be acceptable.
>
> Hmm, do we have a policy about whether or not it is acceptable to
> modify .gitconfig behind the user's back?  It would be nice if the
> check would be done once and then the result gets cached.  So if not
> in .gitconfig, maybe somewhere else.

The reason I suggested either a cheap runtime check or command line
override was because you can be accessing the same repository from two
different machines, with different kdiff3.  If you check once and store
the result in .gitconfig or .git/config, it would not help the situation a
bit, would it?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Added mergetool.kdiff3.doubledash config option
  2008-06-14  6:17       ` Junio C Hamano
@ 2008-06-14  6:29         ` Theodore Tso
  0 siblings, 0 replies; 6+ messages in thread
From: Theodore Tso @ 2008-06-14  6:29 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Patrick.Higgins, git

On Fri, Jun 13, 2008 at 11:17:51PM -0700, Junio C Hamano wrote:
> The reason I suggested either a cheap runtime check or command line
> override was because you can be accessing the same repository from two
> different machines, with different kdiff3.  If you check once and store
> the result in .gitconfig or .git/config, it would not help the situation a
> bit, would it?

Good point.  I'm not sure 0.5s is really fast enough to be considered
a "cheap runtime check", unfortunately.  At the very least it should
be cached across a single "git mergetool" invocation, though; maybe if
that were the case it would be acceptable.

          					- Ted

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-06-14  6:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-12 19:55 [PATCH] Added mergetool.kdiff3.doubledash config option Patrick Higgins
2008-06-12 20:36 ` Junio C Hamano
2008-06-12 22:44   ` Patrick.Higgins
2008-06-13 14:58     ` Theodore Tso
2008-06-14  6:17       ` Junio C Hamano
2008-06-14  6:29         ` Theodore Tso

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).