git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] Detect if kdiff3 supports '--' and do not supply it if not supported
@ 2008-06-12 23:03 Patrick Higgins
  2008-06-13  5:36 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Patrick Higgins @ 2008-06-12 23:03 UTC (permalink / raw)
  To: git; +Cc: tytso, Patrick Higgins

kdiff3 can be compiled with Qt only or with KDE support. If compiled with
Qt only, it does not support '--' and mergetool fails silently.

Signed-off-by: Patrick Higgins <patrick.higgins@cexp.com>
---
 git-mergetool.sh |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/git-mergetool.sh b/git-mergetool.sh
index fcdec4a..85ce004 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -181,12 +181,19 @@ merge_file () {
 
     case "$merge_tool" in
 	kdiff3)
+	    "$merge_tool_path" --auto -o /dev/null -- /dev/null /dev/null
+	    if test $? -ne 0; 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] 2+ messages in thread

* Re: [PATCH v2] Detect if kdiff3 supports '--' and do not supply it if not supported
  2008-06-12 23:03 [PATCH v2] Detect if kdiff3 supports '--' and do not supply it if not supported Patrick Higgins
@ 2008-06-13  5:36 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2008-06-13  5:36 UTC (permalink / raw)
  To: Patrick Higgins; +Cc: git, tytso

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

> kdiff3 can be compiled with Qt only or with KDE support. If compiled with
> Qt only, it does not support '--' and mergetool fails silently.
>
> Signed-off-by: Patrick Higgins <patrick.higgins@cexp.com>
> ---
>  git-mergetool.sh |   11 +++++++++--
>  1 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/git-mergetool.sh b/git-mergetool.sh
> index fcdec4a..85ce004 100755
> --- a/git-mergetool.sh
> +++ b/git-mergetool.sh
> @@ -181,12 +181,19 @@ merge_file () {
>  
>      case "$merge_tool" in
>  	kdiff3)
> +	    "$merge_tool_path" --auto -o /dev/null -- /dev/null /dev/null
> +	    if test $? -ne 0; 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=$?
>  	    ;;

Now, when the name of the merged file begins with a dash (or dash-dash),
what does kdiff3 without KDE do?

I am wondering if it would be simpler and more robust if we did something
like this, which would let us get rid of double-dash from many places...

 git-mergetool.sh |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/git-mergetool.sh b/git-mergetool.sh
index fcdec4a..3d9833e 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -141,10 +141,10 @@ merge_file () {
     fi
 
     ext="$$$(expr "$MERGED" : '.*\(\.[^/]*\)$')"
-    BACKUP="$MERGED.BACKUP.$ext"
-    LOCAL="$MERGED.LOCAL.$ext"
-    REMOTE="$MERGED.REMOTE.$ext"
-    BASE="$MERGED.BASE.$ext"
+    BACKUP="./$MERGED.BACKUP.$ext"
+    LOCAL="./$MERGED.LOCAL.$ext"
+    REMOTE="./$MERGED.REMOTE.$ext"
+    BASE="./$MERGED.BASE.$ext"
 
     mv -- "$MERGED" "$BACKUP"
     cp -- "$BACKUP" "$MERGED"

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

end of thread, other threads:[~2008-06-13  5:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-12 23:03 [PATCH v2] Detect if kdiff3 supports '--' and do not supply it if not supported Patrick Higgins
2008-06-13  5:36 ` Junio C Hamano

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