Skip to contentSkip to conversation

mergetools: Add tortoisegitmerge helper

PATCH In review Sven Strickroth 5 participants 31 messages Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mergetools: Add tortoisegitmerge helper

- The TortoiseGit team renamed TortoiseMerge.exe to TortoiseGitMerge.exe (starting with 1.8.0) in order to make clear that this one has special support for git and prevent confusion with the TortoiseSVN TortoiseMerge version.
- The tortoisemerge mergetool does not work with filenames which have a space in it. Fixing this required changes in git and also in TortoiseGitMerge; see https://github.com/msysgit/msysgit/issues/57.

The new tortoisegitmerge helper was added so that people can still use TortoiseMerge from TortoiseSVN (and older TortoiseGit versions).

---
 Documentation/diff-config.txt          |  4 ++--
 Documentation/git-mergetool.txt        |  4 ++--
 Documentation/merge-config.txt         |  6 +++---
 contrib/completion/git-completion.bash |  2 +-
 git-mergetool--lib.sh                  |  2 +-
 mergetools/tortoisegitmerge            | 17 +++++++++++++++++
 6 files changed, 26 insertions(+), 9 deletions(-)
 create mode 100644 mergetools/tortoisegitmerge
Documentation/diff-config.txt +2 -2
index 4314ad0..13cbe5b 100644
@@ -151,7 +151,7 @@ diff.<driver>.cachetextconv::
 diff.tool::
 	The diff tool to be used by linkgit:git-difftool[1].  This
 	option overrides `merge.tool`, and has the same valid built-in
-	values as `merge.tool` minus "tortoisemerge" and plus
-	"kompare".  Any other value is treated as a custom diff tool,
+	values as `merge.tool` minus "tortoisemerge"/"tortoisegitmerge" and
+	plus "kompare".  Any other value is treated as a custom diff tool,
 	and there must be a corresponding `difftool.<tool>.cmd`
 	option.
Documentation/git-mergetool.txt +2 -2
index 6b563c5..a80cccd 100644
@@ -28,8 +28,8 @@ OPTIONS
 --tool=<tool>::
 	Use the merge resolution program specified by <tool>.
 	Valid values include emerge, gvimdiff, kdiff3,
-	meld, vimdiff, and tortoisemerge. Run `git mergetool --tool-help`
-	for the list of valid <tool> settings.
+	meld, vimdiff, tortoisegitmerge, and tortoisemerge. Run
+	`git mergetool --tool-help` for the list of valid <tool> settings.
 +
 If a merge resolution program is not specified, 'git mergetool'
 will use the configuration variable `merge.tool`.  If the
Documentation/merge-config.txt +3 -3
index 9bb4956..a047646 100644
@@ -55,9 +55,9 @@ merge.tool::
 	Controls which merge resolution program is used by
 	linkgit:git-mergetool[1].  Valid built-in values are: "araxis",
 	"bc3", "diffuse", "ecmerge", "emerge", "gvimdiff", "kdiff3", "meld",
-	"opendiff", "p4merge", "tkdiff", "tortoisemerge", "vimdiff"
-	and "xxdiff".  Any other value is treated is custom merge tool
-	and there must be a corresponding mergetool.<tool>.cmd option.
+	"opendiff", "p4merge", "tkdiff", "tortoisegitmerge", "tortoisemerge",
+	"vimdiff" and "xxdiff".  Any other value is treated is custom merge
+	tool and there must be a corresponding mergetool.<tool>.cmd option.
  merge.verbosity::
 	Controls the amount of output shown by the recursive merge
contrib/completion/git-completion.bash +1 -1
index 90f5f05..5332a33 100644
@@ -1345,7 +1345,7 @@ _git_mergetool ()
 {
 	case "$cur" in
 	--tool=*)
-		__gitcomp "$__git_mergetools_common tortoisemerge" "" "${cur##--tool=}"
+		__gitcomp "$__git_mergetools_common tortoisegitmerge tortoisemerge" "" "${cur##--tool=}"
 		return
 		;;
 	--*)
git-mergetool--lib.sh +1 -1
index f013a03..47183ef 100644
@@ -150,7 +150,7 @@ run_merge_cmd () {
 list_merge_tool_candidates () {
 	if merge_mode
 	then
-		tools="tortoisemerge"
+		tools="tortoisegitmerge tortoisemerge"
 	else
 		tools="kompare"
 	fi
mergetools/tortoisegitmerge new file +17 -0
new file mode 100644
index 0000000..5b802a7
@@ -0,0 +1,17 @@
+can_diff () {
+	return 1
+}
+
+merge_cmd () {
+	if $base_present
+	then
+		touch "$BACKUP"
+		"$merge_tool_path" \
+			-base "$BASE" -mine "$LOCAL" \
+			-theirs "$REMOTE" -merged "$MERGED"
+		check_unchanged
+	else
+		echo "TortoiseGitMerge cannot be used without a base" 1>&2
+		return 1
+	fi
+}
Signature · 3 lines
Best regards,
 Sven Strickroth
 PGP key id F5A9D4C4 @ any key-server
#1 lore raw
Quoted 8 lines · Sven Strickroth

- The TortoiseGit team renamed TortoiseMerge.exe to TortoiseGitMerge.exe (starting with 1.8.0) in order to make clear that this one has special support for git and prevent confusion with the TortoiseSVN TortoiseMerge version.
- The tortoisemerge mergetool does not work with filenames which have a space in it. Fixing this required changes in git and also in TortoiseGitMerge; see https://github.com/msysgit/msysgit/issues/57.

Quoted 6 lines

The new tortoisegitmerge helper was added so that people can still use TortoiseMerge from TortoiseSVN (and older TortoiseGit versions).

---

Applying: mergetools: Add tortoisegitmerge helper
fatal: corrupt patch at line 56

That comes from here:

contrib/completion/git-completion.bash

Quoted 17 lines
Documentation/merge-config.txt +3 -3
index 9bb4956..a047646 100644
@@ -55,9 +55,9 @@ merge.tool::
 	Controls which merge resolution program is used by
 	linkgit:git-mergetool[1].  Valid built-in values are: "araxis",
 	"bc3", "diffuse", "ecmerge", "emerge", "gvimdiff", "kdiff3", "meld",
-	"opendiff", "p4merge", "tkdiff", "tortoisemerge", "vimdiff"
-	and "xxdiff".  Any other value is treated is custom merge tool
-	and there must be a corresponding mergetool.<tool>.cmd option.
+	"opendiff", "p4merge", "tkdiff", "tortoisegitmerge", "tortoisemerge",
+	"vimdiff" and "xxdiff".  Any other value is treated is custom merge
+	tool and there must be a corresponding mergetool.<tool>.cmd option.
  merge.verbosity::
 	Controls the amount of output shown by the recursive merge
contrib/completion/git-completion.bash +0 -0

Notice that we have three pre-context lines but only two post-context lines for this hunk. There is one context line missing at the end of this hunk.

I'd usually try to queue a corrupt patch by manually fixing up when it is a trivial corruption, but a corruption that _loses_ lines is too dangerous to be handled that way. There may be additions in other hunks you wanted to make that were lost for the same reason why the post-context line was lost here, and my fix-up would end up committing a wrong patch.

Please investigate how this happened, and re-send after hearing reviews from others.

Thanks.

#2 lore raw

PATCH 1/1 mergetools: Add tortoisegitmerge helper

- The TortoiseGit team renamed TortoiseMerge.exe to TortoiseGitMerge.exe (starting with 1.8.0) in order to make clear that this one has special support for git and prevent confusion with the TortoiseSVN TortoiseMerge version.
- The tortoisemerge mergetool does not work with filenames which have a space in it. Fixing this required changes in git and also in TortoiseGitMerge; see https://github.com/msysgit/msysgit/issues/57.

The new tortoisegitmerge helper was added so that people can still use TortoiseMerge from TortoiseSVN (and older TortoiseGit versions).

---
 Documentation/diff-config.txt          |  4 ++--
 Documentation/git-mergetool.txt        |  4 ++--
 Documentation/merge-config.txt         |  6 +++---
 contrib/completion/git-completion.bash |  2 +-
 git-mergetool--lib.sh                  |  2 +-
 mergetools/tortoisegitmerge            | 17 +++++++++++++++++
 6 files changed, 26 insertions(+), 9 deletions(-)
 create mode 100644 mergetools/tortoisegitmerge
Documentation/diff-config.txt +2 -2
index 4314ad0..13cbe5b 100644
@@ -151,7 +151,7 @@ diff.<driver>.cachetextconv::
 diff.tool::
 	The diff tool to be used by linkgit:git-difftool[1].  This
 	option overrides `merge.tool`, and has the same valid built-in
-	values as `merge.tool` minus "tortoisemerge" and plus
-	"kompare".  Any other value is treated as a custom diff tool,
+	values as `merge.tool` minus "tortoisemerge"/"tortoisegitmerge" and
+	plus "kompare".  Any other value is treated as a custom diff tool,
 	and there must be a corresponding `difftool.<tool>.cmd`
 	option.
Documentation/git-mergetool.txt +2 -2
index 6b563c5..a80cccd 100644
@@ -28,8 +28,8 @@ OPTIONS
 --tool=<tool>::
 	Use the merge resolution program specified by <tool>.
 	Valid values include emerge, gvimdiff, kdiff3,
-	meld, vimdiff, and tortoisemerge. Run `git mergetool --tool-help`
-	for the list of valid <tool> settings.
+	meld, vimdiff, tortoisegitmerge, and tortoisemerge. Run
+	`git mergetool --tool-help` for the list of valid <tool> settings.
 +
 If a merge resolution program is not specified, 'git mergetool'
 will use the configuration variable `merge.tool`.  If the
Documentation/merge-config.txt +3 -3
index 9bb4956..a047646 100644
@@ -55,9 +55,9 @@ merge.tool::
 	Controls which merge resolution program is used by
 	linkgit:git-mergetool[1].  Valid built-in values are: "araxis",
 	"bc3", "diffuse", "ecmerge", "emerge", "gvimdiff", "kdiff3", "meld",
-	"opendiff", "p4merge", "tkdiff", "tortoisemerge", "vimdiff"
-	and "xxdiff".  Any other value is treated is custom merge tool
-	and there must be a corresponding mergetool.<tool>.cmd option.
+	"opendiff", "p4merge", "tkdiff", "tortoisegitmerge", "tortoisemerge",
+	"vimdiff" and "xxdiff".  Any other value is treated is custom merge
+	tool and there must be a corresponding mergetool.<tool>.cmd option.
 
 merge.verbosity::
 	Controls the amount of output shown by the recursive merge
contrib/completion/git-completion.bash +1 -1
index 14dd5e7..1557d54 100644
@@ -1345,7 +1345,7 @@ _git_mergetool ()
 {
 	case "$cur" in
 	--tool=*)
-		__gitcomp "$__git_mergetools_common tortoisemerge" "" "${cur##--tool=}"
+		__gitcomp "$__git_mergetools_common tortoisegitmerge tortoisemerge" "" "${cur##--tool=}"
 		return
 		;;
 	--*)
git-mergetool--lib.sh +1 -1
index f013a03..47183ef 100644
@@ -150,7 +150,7 @@ run_merge_cmd () {
 list_merge_tool_candidates () {
 	if merge_mode
 	then
-		tools="tortoisemerge"
+		tools="tortoisegitmerge tortoisemerge"
 	else
 		tools="kompare"
 	fi
mergetools/tortoisegitmerge new file +17 -0
new file mode 100644
index 0000000..5b802a7
@@ -0,0 +1,17 @@
+can_diff () {
+	return 1
+}
+
+merge_cmd () {
+	if $base_present
+	then
+		touch "$BACKUP"
+		"$merge_tool_path" \
+			-base="$BASE" -mine="$LOCAL" \
+			-theirs="$REMOTE" -merged="$MERGED"
+		check_unchanged
+	else
+		echo "TortoiseGitMerge cannot be used without a base" 1>&2
+		return 1
+	fi
+}
Signature · 1 line
1.8.0.msysgit.0
#3 lore raw

PATCH 1/1 mergetools: Add tortoisegitmerge helper

In reply to Junio C Hamano

- The TortoiseGit team renamed TortoiseMerge.exe to TortoiseGitMerge.exe (starting with 1.8.0) in order to make clear that this one has special support for git and prevent confusion with the TortoiseSVN TortoiseMerge version.
- The tortoisemerge mergetool does not work with filenames which have a space in it. Fixing this required changes in git and also in TortoiseGitMerge; see https://github.com/msysgit/msysgit/issues/57.

The new tortoisegitmerge helper was added so that people can still use TortoiseMerge from TortoiseSVN (and older TortoiseGit versions).

---
 Documentation/diff-config.txt          |  4 ++--
 Documentation/git-mergetool.txt        |  4 ++--
 Documentation/merge-config.txt         |  6 +++---
 contrib/completion/git-completion.bash |  2 +-
 git-mergetool--lib.sh                  |  2 +-
 mergetools/tortoisegitmerge            | 17 +++++++++++++++++
 6 files changed, 26 insertions(+), 9 deletions(-)
 create mode 100644 mergetools/tortoisegitmerge
Documentation/diff-config.txt +2 -2
index 4314ad0..13cbe5b 100644
@@ -151,7 +151,7 @@ diff.<driver>.cachetextconv::
 diff.tool::
 	The diff tool to be used by linkgit:git-difftool[1].  This
 	option overrides `merge.tool`, and has the same valid built-in
-	values as `merge.tool` minus "tortoisemerge" and plus
-	"kompare".  Any other value is treated as a custom diff tool,
+	values as `merge.tool` minus "tortoisemerge"/"tortoisegitmerge" and
+	plus "kompare".  Any other value is treated as a custom diff tool,
 	and there must be a corresponding `difftool.<tool>.cmd`
 	option.
Documentation/git-mergetool.txt +2 -2
index 6b563c5..a80cccd 100644
@@ -28,8 +28,8 @@ OPTIONS
 --tool=<tool>::
 	Use the merge resolution program specified by <tool>.
 	Valid values include emerge, gvimdiff, kdiff3,
-	meld, vimdiff, and tortoisemerge. Run `git mergetool --tool-help`
-	for the list of valid <tool> settings.
+	meld, vimdiff, tortoisegitmerge, and tortoisemerge. Run
+	`git mergetool --tool-help` for the list of valid <tool> settings.
 +
 If a merge resolution program is not specified, 'git mergetool'
 will use the configuration variable `merge.tool`.  If the
Documentation/merge-config.txt +3 -3
index 9bb4956..a047646 100644
@@ -55,9 +55,9 @@ merge.tool::
 	Controls which merge resolution program is used by
 	linkgit:git-mergetool[1].  Valid built-in values are: "araxis",
 	"bc3", "diffuse", "ecmerge", "emerge", "gvimdiff", "kdiff3", "meld",
-	"opendiff", "p4merge", "tkdiff", "tortoisemerge", "vimdiff"
-	and "xxdiff".  Any other value is treated is custom merge tool
-	and there must be a corresponding mergetool.<tool>.cmd option.
+	"opendiff", "p4merge", "tkdiff", "tortoisegitmerge", "tortoisemerge",
+	"vimdiff" and "xxdiff".  Any other value is treated is custom merge
+	tool and there must be a corresponding mergetool.<tool>.cmd option.
 
 merge.verbosity::
 	Controls the amount of output shown by the recursive merge
contrib/completion/git-completion.bash +1 -1
index 14dd5e7..1557d54 100644
@@ -1345,7 +1345,7 @@ _git_mergetool ()
 {
 	case "$cur" in
 	--tool=*)
-		__gitcomp "$__git_mergetools_common tortoisemerge" "" "${cur##--tool=}"
+		__gitcomp "$__git_mergetools_common tortoisegitmerge tortoisemerge" "" "${cur##--tool=}"
 		return
 		;;
 	--*)
git-mergetool--lib.sh +1 -1
index f013a03..47183ef 100644
@@ -150,7 +150,7 @@ run_merge_cmd () {
 list_merge_tool_candidates () {
 	if merge_mode
 	then
-		tools="tortoisemerge"
+		tools="tortoisegitmerge tortoisemerge"
 	else
 		tools="kompare"
 	fi
mergetools/tortoisegitmerge new file +17 -0
new file mode 100644
index 0000000..5b802a7
@@ -0,0 +1,17 @@
+can_diff () {
+	return 1
+}
+
+merge_cmd () {
+	if $base_present
+	then
+		touch "$BACKUP"
+		"$merge_tool_path" \
+			-base "$BASE" -mine "$LOCAL" \
+			-theirs "$REMOTE" -merged "$MERGED"
+		check_unchanged
+	else
+		echo "TortoiseGitMerge cannot be used without a base" 1>&2
+		return 1
+	fi
+}
Signature · 1 line
1.8.0.msysgit.0
#4 lore raw

Am 21.01.2013 09:26 schrieb Sven Strickroth:

Quoted 10 lines

- The TortoiseGit team renamed TortoiseMerge.exe to TortoiseGitMerge.exe (starting with 1.8.0) in order to make clear that this one has special support for git and prevent confusion with the TortoiseSVN TortoiseMerge version.
- The tortoisemerge mergetool does not work with filenames which have a space in it. Fixing this required changes in git and also in TortoiseGitMerge; see https://github.com/msysgit/msysgit/issues/57.

The new tortoisegitmerge helper was added so that people can still use TortoiseMerge from TortoiseSVN (and older TortoiseGit versions).

Any comments for this patch?

Signature · 3 lines
Best regards,
 Sven Strickroth
 PGP key id F5A9D4C4 @ any key-server
#5 lore raw
In reply to Sven Strickroth
Quoted 4 lines · Sven Strickroth

- The TortoiseGit team renamed TortoiseMerge.exe to TortoiseGitMerge.exe (starting with 1.8.0) in order to make clear that this one has special support for git and prevent confusion with the TortoiseSVN TortoiseMerge version.

Wouldn't it make more sense in such a situation if your users can keep using the old "tortoisemerge" configured in their configuration and when the renamed one is found the mergetool automatically used it, rather than the way your patch is done? It seems that you are forcing all the users to reconfigure or retrain their fingers. Is that the best we can do? Is it too cumbersome to autodetect the presense of tortoisegitmerge and redirect a request for tortoisemerge to it, perhaps using translate_merge_tool_path (cf. mergetools/bc3)?

Assuming that people that have both variants will always want mergetool to use tortoisegitmerge, that is. If there are some features missing from or extra bugs in tortoisegitmerge that makes some people favor tortoisemerge, then giving two choices like your patch does may make more sense. I only know the difference between the two from your four-line description above, but it does not look like it is the case.

Quoted 5 lines
Documentation/diff-config.txt +0 -0
index 4314ad0..13cbe5b 100644

Documentation/diff-config.txt diff.<driver>.cachetextconv:: · line 157

Quoted 9 lines
Documentation/diff-config.txt +2 -2
@@ -151,7 +151,7 @@ diff.<driver>.cachetextconv::
 diff.tool::
 	The diff tool to be used by linkgit:git-difftool[1].  This
 	option overrides `merge.tool`, and has the same valid built-in
-	values as `merge.tool` minus "tortoisemerge" and plus
-	"kompare".  Any other value is treated as a custom diff tool,
+	values as `merge.tool` minus "tortoisemerge"/"tortoisegitmerge" and
+	plus "kompare".  Any other value is treated as a custom diff tool,
 	and there must be a corresponding `difftool.<tool>.cmd`
 	option.

So in short, two tortoises and kompare are only valid as mergetool but cannot be used as difftool? No, I am reading it wrong. merge.tool can be used for both, kompare can be used as difftool, and two tortoises can only be used as mergetool.

This paragraph needs to be rewritten to unconfuse readers. The original is barely intelligible, and it becomes unreadable as the set of tools subtracted by "minus" and added by "plus" grows.

#6 lore raw

Am 24.01.2013 20:51 schrieb Junio C Hamano:

Quoted 11 lines
Quoted 4 lines · Sven Strickroth

- The TortoiseGit team renamed TortoiseMerge.exe to TortoiseGitMerge.exe (starting with 1.8.0) in order to make clear that this one has special support for git and prevent confusion with the TortoiseSVN TortoiseMerge version.

Wouldn't it make more sense in such a situation if your users can keep using the old "tortoisemerge" configured in their configuration and when the renamed one is found the mergetool automatically used it, rather than the way your patch is done?

That was also my first idea, however, TortoiseMerge uses parameters as
follows: '-base:"$BASE"'. TortoiseGitMerge uses values separated by space from keys: '-base "$BASE"'. So both are incompatible (the first approach has problems with spaces in filenames, the TortoiseGitMerge approach fixes this).

Quoted 20 lines
Quoted 5 lines
Documentation/diff-config.txt +0 -0
index 4314ad0..13cbe5b 100644

Documentation/diff-config.txt diff.<driver>.cachetextconv:: · line 157

Quoted 9 lines
Documentation/diff-config.txt +2 -2
@@ -151,7 +151,7 @@ diff.<driver>.cachetextconv::
 diff.tool::
 	The diff tool to be used by linkgit:git-difftool[1].  This
 	option overrides `merge.tool`, and has the same valid built-in
-	values as `merge.tool` minus "tortoisemerge" and plus
-	"kompare".  Any other value is treated as a custom diff tool,
+	values as `merge.tool` minus "tortoisemerge"/"tortoisegitmerge" and
+	plus "kompare".  Any other value is treated as a custom diff tool,
 	and there must be a corresponding `difftool.<tool>.cmd`
 	option.

So in short, two tortoises and kompare are only valid as mergetool but cannot be used as difftool? No, I am reading it wrong. merge.tool can be used for both, kompare can be used as difftool, and two tortoises can only be used as mergetool.

Quoted 3 lines

This paragraph needs to be rewritten to unconfuse readers. The original is barely intelligible, and it becomes unreadable as the set of tools subtracted by "minus" and added by "plus" grows.

But I think this should not be part of this patch.

Signature · 3 lines
Best regards,
 Sven Strickroth
 PGP key id F5A9D4C4 @ any key-server
#7 lore raw

PATCH 1/1 mergetools: Enhance tortoisemerge to work with

TortoiseGitMerge and filenames with spaces

- The TortoiseGit team renamed TortoiseMerge.exe to TortoiseGitMerge.exe (starting with 1.8.0) in order to make clear that this one has special support for git, (uses spaces as cli parameter key-value separators) and prevent confusion with the TortoiseSVN TortoiseMerge version.
- The tortoisemerge mergetool does not work with filenames which have a space in it. Fixing this required changes in git and also in TortoiseGitMerge; see https://github.com/msysgit/msysgit/issues/57.

---
 mergetools/tortoisemerge | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)
mergetools/tortoisemerge +20 -4
index ed7db49..9890737 100644
@@ -6,12 +6,28 @@ merge_cmd () {
 	if $base_present
 	then
 		touch "$BACKUP"
-		"$merge_tool_path" \
-			-base:"$BASE" -mine:"$LOCAL" \
-			-theirs:"$REMOTE" -merged:"$MERGED"
+		if test "$merge_tool_path" == "tortoisegitmerge"
+		then
+			"$merge_tool_path" \
+				-base "$BASE" -mine "$LOCAL" \
+				-theirs "$REMOTE" -merged "$MERGED"
+		else 
+			"$merge_tool_path" \
+				-base:"$BASE" -mine:"$LOCAL" \
+				-theirs:"$REMOTE" -merged:"$MERGED"
+		fi
 		check_unchanged
 	else
-		echo "TortoiseMerge cannot be used without a base" 1>&2
+		echo "$merge_tool_path cannot be used without a base" 1>&2
 		return 1
 	fi
 }
+
+translate_merge_tool_path() {
+	if type tortoisegitmerge >/dev/null 2>/dev/null
+	then
+		echo tortoisegitmerge
+	else
+		echo tortoisemerge
+	fi
+}
Signature · 3 lines
Best regards,
 Sven Strickroth
 PGP key id F5A9D4C4 @ any key-server
#8 lore raw

Re: [PATCH] mergetools: Enhance tortoisemerge to work with

Quoted 21 lines · Sven Strickroth

TortoiseGitMerge and filenames with spaces

- The TortoiseGit team renamed TortoiseMerge.exe to TortoiseGitMerge.exe (starting with 1.8.0) in order to make clear that this one has special support for git, (uses spaces as cli parameter key-value separators) and prevent confusion with the TortoiseSVN TortoiseMerge version.
- The tortoisemerge mergetool does not work with filenames which have a space in it. Fixing this required changes in git and also in TortoiseGitMerge; see https://github.com/msysgit/msysgit/issues/57.

---
 mergetools/tortoisemerge | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)
mergetools/tortoisemerge +0 -0
index ed7db49..9890737 100644

mergetools/tortoisemerge merge_cmd () { · line 9

Quoted 7 lines
mergetools/tortoisemerge +1 -3
@@ -6,12 +6,28 @@ merge_cmd () {
        if $base_present
        then
                touch "$BACKUP"
-               "$merge_tool_path" \
-                       -base:"$BASE" -mine:"$LOCAL" \
-                       -theirs:"$REMOTE" -merged:"$MERGED"
+               if test "$merge_tool_path" == "tortoisegitmerge"

I like the approach this is taking. Thank you.
I have one small note:

I think this should use "=" instead of "==" here.

It might also make sense to wrap a basename call around it so that users can set their own mergetool.tortoisemerge.path

basename="$(basename "$merge_tool_path" .exe)"
if test "$basename" = "tortoisegitmerge"
...

Quoted 29 lines
mergetools/tortoisemerge +19 -2
+               then
+                       "$merge_tool_path" \
+                               -base "$BASE" -mine "$LOCAL" \
+                               -theirs "$REMOTE" -merged "$MERGED"
+               else
+                       "$merge_tool_path" \
+                               -base:"$BASE" -mine:"$LOCAL" \
+                               -theirs:"$REMOTE" -merged:"$MERGED"
+               fi
                check_unchanged
        else
-               echo "TortoiseMerge cannot be used without a base" 1>&2
+               echo "$merge_tool_path cannot be used without a base" 1>&2
                return 1
        fi
 }
+
+translate_merge_tool_path() {
+       if type tortoisegitmerge >/dev/null 2>/dev/null
+       then
+               echo tortoisegitmerge
+       else
+               echo tortoisemerge
+       fi
+}
--

Best regards,
Sven Strickroth
PGP key id F5A9D4C4 @ any key-server

Signature · 1 line
David
#9 lore raw

PATCH 1/1 mergetools: Enhance tortoisemerge to work with

TortoiseGitMerge and filenames with spaces

- The TortoiseGit team renamed TortoiseMerge.exe to TortoiseGitMerge.exe (starting with 1.8.0) in order to make clear that this one has special support for git, (uses spaces as cli parameter key-value separators) and prevent confusion with the TortoiseSVN TortoiseMerge version.
- The tortoisemerge mergetool does not work with filenames which have a space in it. Fixing this required changes in git and also in TortoiseGitMerge; see https://github.com/msysgit/msysgit/issues/57.

---
 mergetools/tortoisemerge | 51 ++++++++++++++++++++++++++++++++----------------
 1 file changed, 34 insertions(+), 17 deletions(-)
mergetools/tortoisemerge +34 -17
index ed7db49..8ee99a5 100644
@@ -1,17 +1,34 @@
-can_diff () {
-	return 1
-}
-
-merge_cmd () {
-	if $base_present
-	then
-		touch "$BACKUP"
-		"$merge_tool_path" \
-			-base:"$BASE" -mine:"$LOCAL" \
-			-theirs:"$REMOTE" -merged:"$MERGED"
-		check_unchanged
-	else
-		echo "TortoiseMerge cannot be used without a base" 1>&2
-		return 1
-	fi
-}
+can_diff () {
+	return 1
+}
+
+merge_cmd () {
+	if $base_present
+	then
+		touch "$BACKUP"
+		basename="$(basename "$merge_tool_path" .exe)"
+		if test "$basename" = "tortoisegitmerge"
+		then
+			"$merge_tool_path" \
+				-base "$BASE" -mine "$LOCAL" \
+				-theirs "$REMOTE" -merged "$MERGED"
+		else 
+			"$merge_tool_path" \
+				-base:"$BASE" -mine:"$LOCAL" \
+				-theirs:"$REMOTE" -merged:"$MERGED"
+		fi
+		check_unchanged
+	else
+		echo "$merge_tool_path cannot be used without a base" 1>&2
+		return 1
+	fi
+}
+
+translate_merge_tool_path() {
+	if type tortoisegitmerge >/dev/null 2>/dev/null
+	then
+		echo tortoisegitmerge
+	else
+		echo tortoisemerge
+	fi
+}
Signature · 3 lines
Best regards,
 Sven Strickroth
 PGP key id F5A9D4C4 @ any key-server
#10 lore raw

Re: [PATCH] mergetools: Enhance tortoisemerge to work with

Quoted 1 line · Sven Strickroth

TortoiseGitMerge and filenames with spaces

??? ECANNOTPARSE.

... ah, wait. Is this a broken-off tail of your subject line?

It may be a sign that you are doing too many unrelated things in a single patch when your subject does not fit on a single line.

Perhaps this is better done as a two-patch series?

* mergetools: fix tortoisemerge support for pathnames with SP
* mergetools: support tortoisegitmerge

Quoted 33 lines
 mergetools/tortoisemerge | 51 ++++++++++++++++++++++++++++++++----------------
 1 file changed, 34 insertions(+), 17 deletions(-)
mergetools/tortoisemerge +8 -17
index ed7db49..8ee99a5 100644
@@ -1,17 +1,34 @@
-can_diff () {
-	return 1
-}
-
-merge_cmd () {
-	if $base_present
-	then
-		touch "$BACKUP"
-		"$merge_tool_path" \
-			-base:"$BASE" -mine:"$LOCAL" \
-			-theirs:"$REMOTE" -merged:"$MERGED"
-		check_unchanged
-	else
-		echo "TortoiseMerge cannot be used without a base" 1>&2
-		return 1
-	fi
-}
+can_diff () {
+	return 1
+}
+
+merge_cmd () {
+	if $base_present
+	then
+		touch "$BACKUP"

mergetools/tortoisemerge line 18

Quoted 10 lines
mergetools/tortoisemerge +10 -0
+		basename="$(basename "$merge_tool_path" .exe)"
+		if test "$basename" = "tortoisegitmerge"
+		then
+			"$merge_tool_path" \
+				-base "$BASE" -mine "$LOCAL" \
+				-theirs "$REMOTE" -merged "$MERGED"
+		else 
+			"$merge_tool_path" \
+				-base:"$BASE" -mine:"$LOCAL" \
+				-theirs:"$REMOTE" -merged:"$MERGED"

Hmph.

How was the support for "names with spaces" added in this new code? I do not spot what is different between this "else" clause and the original body of the merge_cmd (which only supported tortoisemerge).

They seem to be doing exactly the same thing.

Quoted 16 lines
mergetools/tortoisemerge +16 -0
+		fi
+		check_unchanged
+	else
+		echo "$merge_tool_path cannot be used without a base" 1>&2
+		return 1
+	fi
+}
+
+translate_merge_tool_path() {
+	if type tortoisegitmerge >/dev/null 2>/dev/null
+	then
+		echo tortoisegitmerge
+	else
+		echo tortoisemerge
+	fi
+}
#11 lore raw

Re: [PATCH] mergetools: Enhance tortoisemerge to work with

Quoted 6 lines · Am 25.01.2013 19:28 schrieb Junio C Hamano:> Sven Strickroth…
Quoted 2 lines

TortoiseGitMerge and filenames with spaces

??? ECANNOTPARSE.

... ah, wait. Is this a broken-off tail of your subject line?

Yes.

Quoted 14 lines

mergetools/tortoisemerge line 18

Quoted 11 lines
mergetools/tortoisemerge +11 -0
+		touch "$BACKUP"
+		basename="$(basename "$merge_tool_path" .exe)"
+		if test "$basename" = "tortoisegitmerge"
+		then
+			"$merge_tool_path" \
+				-base "$BASE" -mine "$LOCAL" \
+				-theirs "$REMOTE" -merged "$MERGED"
+		else
+			"$merge_tool_path" \
+				-base:"$BASE" -mine:"$LOCAL" \
+				-theirs:"$REMOTE" -merged:"$MERGED"

Hmph.

Quoted 5 lines

How was the support for "names with spaces" added in this new code? I do not spot what is different between this "else" clause and the original body of the merge_cmd (which only supported tortoisemerge).

They seem to be doing exactly the same thing.

Erhm, no. As already stated and also mentioned in the commit log:
TortoiseMerge has cli parameter key-values separated by colons, TortoiseGitMerge has key-values separated by spaces.

Signature · 3 lines
Best regards,
 Sven Strickroth
 PGP key id F5A9D4C4 @ any key-server
#12 lore raw

Re: [PATCH] mergetools: Enhance tortoisemerge to work with

In reply to Junio C Hamano

The TortoiseGit team renamed TortoiseMerge.exe to TortoiseGitMerge.exe (starting with 1.8.0) in order to make clear that this one has special support for git and prevent confusion with the TortoiseSVN TortoiseMerge version.

---
 mergetools/tortoisemerge | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
mergetools/tortoisemerge +10 -1
index ed7db49..8476afa 100644
@@ -11,7 +11,16 @@ merge_cmd () {
 			-theirs:"$REMOTE" -merged:"$MERGED"
 		check_unchanged
 	else
-		echo "TortoiseMerge cannot be used without a base" 1>&2
+		echo "$merge_tool_path cannot be used without a base" 1>&2
 		return 1
 	fi
 }
+
+translate_merge_tool_path() {
+	if type tortoisegitmerge >/dev/null 2>/dev/null
+	then
+		echo tortoisegitmerge
+	else
+		echo tortoisemerge
+	fi
+}
Signature · 3 lines
Best regards,
 Sven Strickroth
 PGP key id F5A9D4C4 @ any key-server
#13 lore raw

PATCH 1/2 mergetools: Added support for TortoiseGitMerge

In reply to Junio C Hamano

The TortoiseGit team renamed TortoiseMerge.exe to TortoiseGitMerge.exe (starting with 1.8.0) in order to make clear that this one has special support for git and prevent confusion with the TortoiseSVN TortoiseMerge version.

---
 mergetools/tortoisemerge | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
mergetools/tortoisemerge +10 -1
index ed7db49..8476afa 100644
@@ -11,7 +11,16 @@ merge_cmd () {
 			-theirs:"$REMOTE" -merged:"$MERGED"
 		check_unchanged
 	else
-		echo "TortoiseMerge cannot be used without a base" 1>&2
+		echo "$merge_tool_path cannot be used without a base" 1>&2
 		return 1
 	fi
 }
+
+translate_merge_tool_path() {
+	if type tortoisegitmerge >/dev/null 2>/dev/null
+	then
+		echo tortoisegitmerge
+	else
+		echo tortoisemerge
+	fi
+}
Signature · 3 lines
Best regards,
 Sven Strickroth
 PGP key id F5A9D4C4 @ any key-server
#14 lore raw

PATCH 2/2 mergetools: Make tortoisemerge work with

In reply to Junio C Hamano

tortoisegitmerge and filesnames with space

The tortoisemerge mergetool does not work with filenames which have a space in it. Fixing this required changes in git and also in TortoiseGitMerge; see https://github.com/msysgit/msysgit/issues/57.

TortoiseGitMerge now separates cli parameter key-values by space instead of colons as TortoiseSVN TortoiseMerge does and supports filesnames with spaces in it this way now.

---
 mergetools/tortoisemerge | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
mergetools/tortoisemerge +11 -3
index 8476afa..2f98829 100644
@@ -6,9 +6,17 @@ merge_cmd () {
 	if $base_present
 	then
 		touch "$BACKUP"
-		"$merge_tool_path" \
-			-base:"$BASE" -mine:"$LOCAL" \
-			-theirs:"$REMOTE" -merged:"$MERGED"
+		basename="$(basename "$merge_tool_path" .exe)"
+		if test "$basename" = "tortoisegitmerge"
+		then
+			"$merge_tool_path" \
+				-base "$BASE" -mine "$LOCAL" \
+				-theirs "$REMOTE" -merged "$MERGED"
+		else 
+			"$merge_tool_path" \
+				-base:"$BASE" -mine:"$LOCAL" \
+				-theirs:"$REMOTE" -merged:"$MERGED"
+		fi
 		check_unchanged
 	else
 		echo "$merge_tool_path cannot be used without a base" 1>&2
Signature · 3 lines
Best regards,
 Sven Strickroth
 PGP key id F5A9D4C4 @ any key-server
#15 lore raw

Re: [PATCH 2/2] mergetools: Make tortoisemerge work with

Quoted 3 lines · Sven Strickroth

TortoiseGitMerge now separates cli parameter key-values by space instead of colons as TortoiseSVN TortoiseMerge does and supports filesnames with spaces in it this way now.

These patches look correct (I do not have the tool to test) but I think we should fixup this commit message.

How about something like...

mergetools: Teach tortoisemerge about TortoiseGitMerge

TortoiseGitMerge improved its syntax to allow for file paths with spaces. Detect when it is installed and prefer it over TortoiseMerge.

Signature · 1 line
David
#16 lore raw

Re: [PATCH 2/2] mergetools: Make tortoisemerge work with

Am 26.01.2013 08:10 schrieb David Aguilar:

Quoted 10 lines

These patches look correct (I do not have the tool to test) but I think we should fixup this commit message.

How about something like...

mergetools: Teach tortoisemerge about TortoiseGitMerge

TortoiseGitMerge improved its syntax to allow for file paths with spaces. Detect when it is installed and prefer it over TortoiseMerge.

This message implies, that I have to combine two patches again?!

Signature · 3 lines
Best regards,
 Sven Strickroth
 PGP key id F5A9D4C4 @ any key-server
#17 lore raw

Re: [PATCH 2/2] mergetools: Make tortoisemerge work with

Quoted 6 lines · Sven Strickroth

Am 26.01.2013 08:10 schrieb David Aguilar:

Quoted 5 lines

These patches look correct (I do not have the tool to test) but I think we should fixup this commit message.

How about something like...

Quoted 7 lines
Quoted 5 lines

mergetools: Teach tortoisemerge about TortoiseGitMerge

TortoiseGitMerge improved its syntax to allow for file paths with spaces. Detect when it is installed and prefer it over TortoiseMerge.

This message implies, that I have to combine two patches again?!

We can see that [1/2] teaches mergetool to use tortoisegitmerge when the user tells it to use tortoisemerge and the former is available.

The change in [2/2] is to use -base "$BASE" instead of -base:"$BASE" when the real tool is tortoisegitmerge (when it is tortoisemerge, nothing changes).

By reading these two patches, I would imagine that tortoisegitmerge can accept both forms, i.e. -base:"$BASE" and -base "$BASE", but the patch [2/2] considers that the latter form is preferrable in some way. As you talked about "paths with SPs in them", I would imagine that is the difference? That is -base:"$BASE" form will not work if the varilable $BASE has a SP in it (even though it is encolosed in dq, which does not make much sense from my POSIXy point of view, but perhaps command line argument processing in the Windows land may have different rules) but if you write -base "$BASE" then "$BASE" will be taken as a single thing even it has a SP in it? Also I would guess that the reason why patch [2/2] does this only for tortoisegitmerge is either because tortoisemerge will break paths with SPs even if it is given -base "$BASE" form, or because it only accepts -base:"$BASE" form? I cannot read it from your description, but let's assume that is the reason.

If that is the case, then the log message for the second patch would be easier to understand if it says so in a more explicit way, perhaps like this:

TortoiseGitMerge, unlike TortoiseMerge, can be told to handle paths with SPs in them by using -option "$FILE" (not -option:"$FILE", which does not work for such paths) syntax.

Use it to allow such paths to be handled correctly.

But I cannot read exactly why the patch [2/2] considers -base "$BASE" is preferrable over -base:"$BASE" from your original description, so this may well be way off the mark.

In short, I think proposed log message for [2/2] was not clear what is being fixed and how.

#18 lore raw

PATCH 1/1 mergetools: Enable tortoisemerge to handle filenames with

spaces with TortoiseGitMerge

TortoiseGitMerge, unlike TortoiseMerge, can be told to handle paths with spaces in them by using -option "$FILE" (not -option:"$FILE", which does not work for such paths) syntax. Both do not have a fully posix compatible cli parameter parser, however, TortoiseGitMerge was modified in order to handle filenames with spaces correctly. The "-key value" form was choosen because this way no escaping for quotes within quotes is necessary; see
https://github.com/msysgit/msysgit/issues/57

---
 mergetools/tortoisemerge | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
mergetools/tortoisemerge +11 -3
index 8476afa..3b89f1c 100644
@@ -6,9 +6,17 @@ merge_cmd () {
 	if $base_present
 	then
 		touch "$BACKUP"
-		"$merge_tool_path" \
-			-base:"$BASE" -mine:"$LOCAL" \
-			-theirs:"$REMOTE" -merged:"$MERGED"
+		basename="$(basename "$merge_tool_path" .exe)"
+		if test "$basename" = "tortoisegitmerge"
+		then
+			"$merge_tool_path" \
+				-base "$BASE" -mine "$LOCAL" \
+				-theirs "$REMOTE" -merged "$MERGED"
+		else
+			"$merge_tool_path" \
+				-base:"$BASE" -mine:"$LOCAL" \
+				-theirs:"$REMOTE" -merged:"$MERGED"
+		fi
 		check_unchanged
 	else
 		echo "$merge_tool_path cannot be used without a base" 1>&2
Signature · 3 lines
Best regards,
 Sven Strickroth
 PGP key id F5A9D4C4 @ any key-server
#19 lore raw

Re: [PATCH] mergetools: Enable tortoisemerge to handle filenames with

Quoted 8 lines · Sven Strickroth

TortoiseGitMerge, unlike TortoiseMerge, can be told to handle paths with spaces in them by using -option "$FILE" (not -option:"$FILE", which does not work for such paths) syntax. Both do not have a fully posix compatible cli parameter parser, however, TortoiseGitMerge was modified in order to handle filenames with spaces correctly. The "-key value" form was choosen because this way no escaping for quotes within quotes is necessary; see
https://github.com/msysgit/msysgit/issues/57

The commit message still does not mention MSYS path mangling at all, which probably is why the reasoning of this patch was not yet fully understood. I'd recommend something like the following:

mergetools: Teach tortoisemerge about TortoiseGitMerge

TortoiseGitMerge is an improved version of TortoiseMerge specifically for use with Git on Windows. Due to MSYS path mangling [1], the ":" after the "base" etc. arguments to TortoiseMerge caused to whole argument instead of just the file name to be quoted in case of file names with spaces. So TortoiseMerge was passed

"-base:new file.txt"

instead of

-base:"new file.txt"

(including the quotes). To work around this, TortoiseGitMerge does not require the ":" after the arguments anymore which fixes handling file names with spaces.

[1] http://www.mingw.org/wiki/Posix_path_conversion

Signature · 1 line
Sebastian Schuberth
#20 lore raw

Re: [PATCH] mergetools: Enable tortoisemerge to handle filenames with

Am 01.02.2013 21:07 schrieb Sebastian Schuberth:

Quoted 1 line

mergetools: Teach tortoisemerge about TortoiseGitMerge

This subject doesn't make any sense if we don't combine the two patches.

Signature · 3 lines
Best regards,
 Sven Strickroth
 PGP key id F5A9D4C4 @ any key-server
#21 lore raw

Re: [PATCH] mergetools: Enable tortoisemerge to handle filenames with spaces with TortoiseGitMerge

In reply to Sebastian Schuberth

TortoiseGitMerge, unlike TortoiseMerge, can be told to handle paths with spaces in them by using -option "$FILE" (not -option:"$FILE", which does not work for such paths) syntax.

This change was necessary because of MSYS path mangling [1], the ":" after the "base" etc. arguments to TortoiseMerge caused to whole argument instead of just the file name to be quoted in case of file names with spaces. So TortoiseMerge was passed

"-base:new file.txt"

instead of

-base:"new file.txt"

(including the quotes). To work around this, TortoiseGitMerge does not require the ":" after the arguments anymore which fixes handling file names with spaces [2] (as written above).

[1] http://www.mingw.org/wiki/Posix_path_conversion
[2] https://github.com/msysgit/msysgit/issues/57

---
 mergetools/tortoisemerge | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
mergetools/tortoisemerge +11 -3
index 8476afa..3b89f1c 100644
@@ -6,9 +6,17 @@ merge_cmd () {
 	if $base_present
 	then
 		touch "$BACKUP"
-		"$merge_tool_path" \
-			-base:"$BASE" -mine:"$LOCAL" \
-			-theirs:"$REMOTE" -merged:"$MERGED"
+		basename="$(basename "$merge_tool_path" .exe)"
+		if test "$basename" = "tortoisegitmerge"
+		then
+			"$merge_tool_path" \
+				-base "$BASE" -mine "$LOCAL" \
+				-theirs "$REMOTE" -merged "$MERGED"
+		else
+			"$merge_tool_path" \
+				-base:"$BASE" -mine:"$LOCAL" \
+				-theirs:"$REMOTE" -merged:"$MERGED"
+		fi
 		check_unchanged
 	else
 		echo "$merge_tool_path cannot be used without a base" 1>&2
Signature · 1 line
1.8.1.msysgit.1
#22 lore raw

Re: [PATCH] mergetools: Enable tortoisemerge to handle filenames with spaces with TortoiseGitMerge

Quoted 2 lines · Sven Strickroth

TortoiseMerge caused to whole
argument instead of just the file name to be quoted

s/caused to whole/caused the whole/

I think this commit message is very nice. Is it too late to replace the current patch with this one?

Signature · 1 line
David
#23 lore raw

Re: [PATCH] mergetools: Enable tortoisemerge to handle filenames with spaces with TortoiseGitMerge

Quoted 9 lines · David Aguilar
Quoted 2 lines · Sven Strickroth

TortoiseMerge caused to whole
argument instead of just the file name to be quoted

s/caused to whole/caused the whole/

I think this commit message is very nice. Is it too late to replace the current patch with this one?

Haven't merged it to 'next'; I will replace with this, with a bit of retitling to make it shorter.

commit 81ed7b9581f7eafb334824264abb492d85a5ffb8

Author: Sven Strickroth <[email protected]>
Date:   Fri Feb 1 21:16:30 2013 +0100

mergetools: teach tortoisemerge to handle filenames with SP correctly

TortoiseGitMerge, unlike TortoiseMerge, can be told to handle paths with spaces in them by using -option "$FILE" (not -option:"$FILE", which does not work for such paths) syntax.

This change was necessary because of MSYS path mangling [1], the ":" after the "base" etc. arguments to TortoiseMerge caused the whole argument instead of just the file name to be quoted in case of file names with spaces. So TortoiseMerge was passed

"-base:new file.txt"

instead of

-base:"new file.txt"

(including the quotes). To work around this, TortoiseGitMerge does not require the ":" after the arguments anymore which fixes handling file names with spaces [2] (as written above).

[1] http://www.mingw.org/wiki/Posix_path_conversion
[2] https://github.com/msysgit/msysgit/issues/57

#24 lore raw

Re: [PATCH] mergetools: Enable tortoisemerge to handle filenames with

In reply to Sebastian Schuberth
Quoted 3 lines · Sebastian Schuberth

The commit message still does not mention MSYS path mangling at all, which probably is why the reasoning of this patch was not yet fully understood.

Ahh, you are very right. I didn't realize that was what this funny "with colon, with SP" business was about.

Quoted 14 lines

I'd recommend something like the following:

mergetools: Teach tortoisemerge about TortoiseGitMerge

TortoiseGitMerge is an improved version of TortoiseMerge specifically for use with Git on Windows. Due to MSYS path mangling [1], the ":" after the "base" etc. arguments to TortoiseMerge caused to whole argument instead of just the file name to be quoted in case of file names with spaces. So TortoiseMerge was passed

"-base:new file.txt"

instead of

Quoted 7 lines

-base:"new file.txt"

(including the quotes). To work around this, TortoiseGitMerge does not require the ":" after the arguments anymore which fixes handling file names with spaces.

[1] http://www.mingw.org/wiki/Posix_path_conversion

Sven?

#25 lore raw

Re: [PATCH] mergetools: Enable tortoisemerge to handle filenames with

Am 01.02.2013 21:15 schrieb Junio C Hamano:

Quoted 12 lines
Quoted 12 lines

TortoiseGitMerge is an improved version of TortoiseMerge specifically for use with Git on Windows. Due to MSYS path mangling [1], the ":" after the "base" etc. arguments to TortoiseMerge caused to whole argument instead of just the file name to be quoted in case of file names with spaces. So TortoiseMerge was passed

"-base:new file.txt"

instead of

-base:"new file.txt"

Quoted 7 lines
Quoted 5 lines

(including the quotes). To work around this, TortoiseGitMerge does not require the ":" after the arguments anymore which fixes handling file names with spaces.

[1] http://www.mingw.org/wiki/Posix_path_conversion

Sven?

I just mailed a new patch. Thanks to Sebastian for pointing this out!

@Junio: Feel free to optimize the commit message.

Signature · 3 lines
Best regards,
 Sven Strickroth
 PGP key id F5A9D4C4 @ any key-server
#26 lore raw
In reply to Sven Strickroth
Quoted 13 lines · Sven Strickroth

Am 24.01.2013 20:51 schrieb Junio C Hamano:

Quoted 11 lines
Quoted 4 lines · Sven Strickroth

- The TortoiseGit team renamed TortoiseMerge.exe to TortoiseGitMerge.exe (starting with 1.8.0) in order to make clear that this one has special support for git and prevent confusion with the TortoiseSVN TortoiseMerge version.

Wouldn't it make more sense in such a situation if your users can keep using the old "tortoisemerge" configured in their configuration and when the renamed one is found the mergetool automatically used it, rather than the way your patch is done?

Quoted 5 lines

That was also my first idea, however, TortoiseMerge uses parameters as
follows: '-base:"$BASE"'. TortoiseGitMerge uses values separated by space from keys: '-base "$BASE"'. So both are incompatible (the first approach has problems with spaces in filenames, the TortoiseGitMerge approach fixes this).

OK. Please unconfuse future readers of "git log" by saying why such a unification does not work in the proposed log message.

Quoted 20 lines
Quoted 20 lines
Quoted 5 lines
Documentation/diff-config.txt +0 -0
index 4314ad0..13cbe5b 100644

Documentation/diff-config.txt diff.<driver>.cachetextconv:: · line 157

Quoted 9 lines
Documentation/diff-config.txt +2 -2
@@ -151,7 +151,7 @@ diff.<driver>.cachetextconv::
 diff.tool::
 	The diff tool to be used by linkgit:git-difftool[1].  This
 	option overrides `merge.tool`, and has the same valid built-in
-	values as `merge.tool` minus "tortoisemerge" and plus
-	"kompare".  Any other value is treated as a custom diff tool,
+	values as `merge.tool` minus "tortoisemerge"/"tortoisegitmerge" and
+	plus "kompare".  Any other value is treated as a custom diff tool,
 	and there must be a corresponding `difftool.<tool>.cmd`
 	option.

So in short, two tortoises and kompare are only valid as mergetool but cannot be used as difftool? No, I am reading it wrong. merge.tool can be used for both, kompare can be used as difftool, and two tortoises can only be used as mergetool.

Quoted 5 lines
Quoted 3 lines

This paragraph needs to be rewritten to unconfuse readers. The original is barely intelligible, and it becomes unreadable as the set of tools subtracted by "minus" and added by "plus" grows.

But I think this should not be part of this patch.

I agree that it can be done (and it is better to be done) as a preparatory step. The current text is barely readable, but with this patch there will be two "minus", and the result becomes unreadable at that point.

It also could be done as a follow-up documentation readability fix.

#27 lore raw
Quoted 15 lines · Junio C Hamano
Quoted 13 lines · Sven Strickroth

Am 24.01.2013 20:51 schrieb Junio C Hamano:

Quoted 11 lines
Quoted 4 lines · Sven Strickroth

- The TortoiseGit team renamed TortoiseMerge.exe to TortoiseGitMerge.exe (starting with 1.8.0) in order to make clear that this one has special support for git and prevent confusion with the TortoiseSVN TortoiseMerge version.

Wouldn't it make more sense in such a situation if your users can keep using the old "tortoisemerge" configured in their configuration and when the renamed one is found the mergetool automatically used it, rather than the way your patch is done?

Quoted 8 lines
Quoted 5 lines

That was also my first idea, however, TortoiseMerge uses parameters as
follows: '-base:"$BASE"'. TortoiseGitMerge uses values separated by space from keys: '-base "$BASE"'. So both are incompatible (the first approach has problems with spaces in filenames, the TortoiseGitMerge approach fixes this).

OK. Please unconfuse future readers of "git log" by saying why such a unification does not work in the proposed log message.

Even though the old tortoisemerge and the new tortoisegitmerge have completely different syntax, could we still use the existence of one when deciding which syntax to use?

pseudo-code at the top of the scriptlet:

if test -z "$tortoisegitmerge"
then
if type tortoisegitmerge 2>&1 >/dev/null
then
tortoisegitmerge=true
else
tortoisegitmerge=false
fi
fi

...and then later merge_cmd and diff_cmd
can delegate to {diff,merge}_cmd_legacy() and {diff,merge}_cmd_gitmerge() functions to do the work.

It's just a thought. translate_merge_tool_path() is too low-level to do it, but it seems like we could get away with it by having some extra smarts in the scriptlet.

Quoted 24 lines
Quoted 24 lines
Quoted 23 lines
Quoted 5 lines
Documentation/diff-config.txt +0 -0
index 4314ad0..13cbe5b 100644

Documentation/diff-config.txt diff.<driver>.cachetextconv:: · line 157

Quoted 9 lines
Documentation/diff-config.txt +2 -2
@@ -151,7 +151,7 @@ diff.<driver>.cachetextconv::
 diff.tool::
    The diff tool to be used by linkgit:git-difftool[1].  This
    option overrides `merge.tool`, and has the same valid built-in
-   values as `merge.tool` minus "tortoisemerge" and plus
-   "kompare".  Any other value is treated as a custom diff tool,
+   values as `merge.tool` minus "tortoisemerge"/"tortoisegitmerge" and
+   plus "kompare".  Any other value is treated as a custom diff tool,
    and there must be a corresponding `difftool.<tool>.cmd`
    option.

So in short, two tortoises and kompare are only valid as mergetool but cannot be used as difftool? No, I am reading it wrong. merge.tool can be used for both, kompare can be used as difftool, and two tortoises can only be used as mergetool.

This paragraph needs to be rewritten to unconfuse readers. The original is barely intelligible, and it becomes unreadable as the set of tools subtracted by "minus" and added by "plus" grows.

Quoted 8 lines
Quoted 1 line

But I think this should not be part of this patch.

I agree that it can be done (and it is better to be done) as a preparatory step. The current text is barely readable, but with this patch there will be two "minus", and the result becomes unreadable at that point.

It also could be done as a follow-up documentation readability fix.

Another thought would be to minimize this section as much as possible and point users to "git difftool --tool-help".

We can then improve --tool-help (there are already preliminary patches in-flight to do so) so that we do not have to maintain this documentation in the future.

Likewise, if we are able to teach the scriptlet to choose the best one (and not require a new scriptlet) then this section could be left as-is for this patch.

Signature · 1 line
David
#28 lore raw
Quoted 8 lines · David Aguilar

Even though the old tortoisemerge and the new tortoisegitmerge have completely different syntax, could we still use the existence of one when deciding which syntax to use?
...
...and then later merge_cmd and diff_cmd
can delegate to {diff,merge}_cmd_legacy() and {diff,merge}_cmd_gitmerge() functions to do the work.

Quoted 4 lines

It's just a thought. translate_merge_tool_path() is too low-level to do it, but it seems like we could get away with it by having some extra smarts in the scriptlet.

Sounds like a far better approach to me. I'd like to at least see an attempt be made to make that work first.

Quoted 11 lines
Quoted 11 lines
Quoted 5 lines
Quoted 3 lines

This paragraph needs to be rewritten to unconfuse readers. The original is barely intelligible, and it becomes unreadable as the set of tools subtracted by "minus" and added by "plus" grows.

But I think this should not be part of this patch.

I agree that it can be done (and it is better to be done) as a preparatory step. The current text is barely readable, but with this patch there will be two "minus", and the result becomes unreadable at that point.

Quoted 4 lines
Quoted 1 line

It also could be done as a follow-up documentation readability fix.

Another thought would be to minimize this section as much as possible and point users to "git difftool --tool-help".

We had a similar discussion here:

http://thread.gmane.org/gmane.comp.version-control.git/201913/focus=201976

and Documentation/git-{diff,merge}tool.txt have stayed quiet since then.

But Documentation/merge-config.txt tries to list everything that _could_ be enabled, and I do not necessarily think having one single location that lists everything is such a bad idea.

Is there a way for me to programatically tell what merge.tool and diff.tool could be enabled for a particular source checkout of Git regardless of what platform am I on (that is, even though I won't touch Windows, I want to see 'tortoise' appear in the output of such a procedure)? We could generate a small text file from the Makefile in Documentation and include it when building the manual pages if such a procedure is available.

#29 lore raw
Quoted 28 lines · Junio C Hamano
Quoted 11 lines · David Aguilar
Quoted 11 lines
Quoted 5 lines
Quoted 3 lines

This paragraph needs to be rewritten to unconfuse readers. The original is barely intelligible, and it becomes unreadable as the set of tools subtracted by "minus" and added by "plus" grows.

But I think this should not be part of this patch.

I agree that it can be done (and it is better to be done) as a preparatory step. The current text is barely readable, but with this patch there will be two "minus", and the result becomes unreadable at that point.

Quoted 4 lines
Quoted 1 line

It also could be done as a follow-up documentation readability fix.

Another thought would be to minimize this section as much as possible and point users to "git difftool --tool-help".

We had a similar discussion here:

http://thread.gmane.org/gmane.comp.version-control.git/201913/focus=201976

and Documentation/git-{diff,merge}tool.txt have stayed quiet since then.

But Documentation/merge-config.txt tries to list everything that _could_ be enabled, and I do not necessarily think having one single location that lists everything is such a bad idea.

Quoted 7 lines

Is there a way for me to programatically tell what merge.tool and diff.tool could be enabled for a particular source checkout of Git regardless of what platform am I on (that is, even though I won't touch Windows, I want to see 'tortoise' appear in the output of such a procedure)? We could generate a small text file from the Makefile in Documentation and include it when building the manual pages if such a procedure is available.

That's a good idea.
Here's one way... (typed into gmail, so probably broken)

LF='
'
mergetools=
difftools=
scriptlets="$(git --exec-path)"/mergetools

for script in "$scriptlets"/*
do

    tool="$(basename "$script")"
    if test "$tool" = "defaults"
    then
        continue
    fi
    . "$scriptlets"/defaults
    can_diff && difftools="$difftools$tool$LF"
    can_merge && mergetools="$mergetools$tool$LF"

done

I can follow up with a Documentation patch along these lines. I'm would imagine it would be hooked up similarly to how the command lists are constructed.

This should allow the tortoisemerge improvements to happen independently.

Signature · 1 line
David
#30 lore raw
Quoted 28 lines · David Aguilar
Quoted 7 lines · Junio C Hamano

Is there a way for me to programatically tell what merge.tool and diff.tool could be enabled for a particular source checkout of Git regardless of what platform am I on (that is, even though I won't touch Windows, I want to see 'tortoise' appear in the output of such a procedure)? We could generate a small text file from the Makefile in Documentation and include it when building the manual pages if such a procedure is available.

That's a good idea.
Here's one way... (typed into gmail, so probably broken)

LF='
'
mergetools=
difftools=
scriptlets="$(git --exec-path)"/mergetools

for script in "$scriptlets"/*
do

    tool="$(basename "$script")"
    if test "$tool" = "defaults"
    then
        continue
    fi
    . "$scriptlets"/defaults
    can_diff && difftools="$difftools$tool$LF"
    can_merge && mergetools="$mergetools$tool$LF"
Quoted 1 line

done

I don't think this will work since the names of the valid tools are not necessarily the same as the names of the scriptlets - this is the exact issue that prompted my patches to git-difftool yesterday.

The best option I can see given what's currently available is something like this:

-- >8 --

sed -n -e '/^list_merge_tool_candidates/,/^}/ {
        /tools=/ {
                s/.*tools=//
                s/"//g
                s/\$tools//
                s/ /\n/g
                p
        }
}' git-mergetool--lib.sh |sort |uniq |while read -r tool
do
	test -z "$tool" && continue
	( . git-mergetool--lib && setup_tool $tool
        	# Use can_diff and can_merge here.
	)

done

-- 8< --

John