git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 1/2] mergetool--lib: set IFS for difftool and mergetool
@ 2015-05-20  9:02 David Aguilar
  2015-05-20  9:02 ` [PATCH v5 2/2] mergetools: add winmerge as a builtin tool David Aguilar
  2015-05-20  9:04 ` [PATCH v5 1/2] mergetool--lib: set IFS for difftool and mergetool Sebastian Schuberth
  0 siblings, 2 replies; 3+ messages in thread
From: David Aguilar @ 2015-05-20  9:02 UTC (permalink / raw)
  To: Phil Susi, git
  Cc: Junio C Hamano, Philip Oakley, Johannes Schindelin,
	Sebastian Schuberth, SZEDER Gábor

git-sh-setup sets IFS but it is not used by git-difftool--helper.
Set IFS in git-mergetool--lib so that the mergetool scriptlets,
diftool, and mergetool do not need to do so.

Signed-off-by: David Aguilar <davvid@gmail.com>
---
This patch is new since last time.  It simplifies the patch that follows.

 git-mergetool--lib.sh | 3 +++
 git-mergetool.sh      | 2 --
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
index fe61e89..14b039d 100644
--- a/git-mergetool--lib.sh
+++ b/git-mergetool--lib.sh
@@ -2,6 +2,9 @@
 
 : ${MERGE_TOOLS_DIR=$(git --exec-path)/mergetools}
 
+IFS='
+'
+
 mode_ok () {
 	if diff_mode
 	then
diff --git a/git-mergetool.sh b/git-mergetool.sh
index d20581c..9f77e3a 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -451,8 +451,6 @@ fi
 printf "Merging:\n"
 printf "%s\n" "$files"
 
-IFS='
-'
 rc=0
 for i in $files
 do
-- 
2.4.1.218.gc09a0e5

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

* [PATCH v5 2/2] mergetools: add winmerge as a builtin tool
  2015-05-20  9:02 [PATCH v5 1/2] mergetool--lib: set IFS for difftool and mergetool David Aguilar
@ 2015-05-20  9:02 ` David Aguilar
  2015-05-20  9:04 ` [PATCH v5 1/2] mergetool--lib: set IFS for difftool and mergetool Sebastian Schuberth
  1 sibling, 0 replies; 3+ messages in thread
From: David Aguilar @ 2015-05-20  9:02 UTC (permalink / raw)
  To: Phil Susi, git
  Cc: Junio C Hamano, Philip Oakley, Johannes Schindelin,
	Sebastian Schuberth, SZEDER Gábor

Add a winmerge scriptlet with the commands described in [1] so
that users can use winmerge without needing to perform any
additional configuration.

[1] http://thread.gmane.org/gmane.comp.version-control.git/268631

Helped-by: Philip Oakley <philipoakley@iee.org>
Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Helped-by: Sebastian Schuberth <sschuberth@gmail.com>
Helped-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: David Aguilar <davvid@gmail.com>
---
Changes since v4: we no longer need to worry about IFS since
it's already been set by patch 1/2.

 mergetools/winmerge | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 mergetools/winmerge

diff --git a/mergetools/winmerge b/mergetools/winmerge
new file mode 100644
index 0000000..3e9f908
--- /dev/null
+++ b/mergetools/winmerge
@@ -0,0 +1,37 @@
+diff_cmd () {
+	"$merge_tool_path" -u -e "$LOCAL" "$REMOTE"
+	return 0
+}
+
+merge_cmd () {
+	# mergetool.winmerge.trustExitCode is implicitly false.
+	# touch $BACKUP so that we can check_unchanged.
+	touch "$BACKUP"
+	"$merge_tool_path" -u -e -dl Local -dr Remote \
+		"$LOCAL" "$REMOTE" "$MERGED"
+	check_unchanged
+}
+
+translate_merge_tool_path() {
+	# Use WinMergeU.exe if it exists in $PATH
+	if type -p WinMergeU.exe >/dev/null 2>&1
+	then
+		printf WinMergeU.exe
+		return
+	fi
+
+	# Look for WinMergeU.exe in the typical locations
+	winmerge_exe="WinMerge/WinMergeU.exe"
+	for directory in $(env | grep -Ei '^PROGRAM(FILES(\(X86\))?|W6432)=' |
+		cut -d '=' -f 2- | sort -u)
+	do
+		if test -n "$directory" && test -x "$directory/$winmerge_exe"
+		then
+			printf '%s' "$directory/$winmerge_exe"
+			return
+		fi
+	done
+
+	printf WinMergeU.exe
+}
-- 
2.4.1.218.gc09a0e5

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

* Re: [PATCH v5 1/2] mergetool--lib: set IFS for difftool and mergetool
  2015-05-20  9:02 [PATCH v5 1/2] mergetool--lib: set IFS for difftool and mergetool David Aguilar
  2015-05-20  9:02 ` [PATCH v5 2/2] mergetools: add winmerge as a builtin tool David Aguilar
@ 2015-05-20  9:04 ` Sebastian Schuberth
  1 sibling, 0 replies; 3+ messages in thread
From: Sebastian Schuberth @ 2015-05-20  9:04 UTC (permalink / raw)
  To: David Aguilar
  Cc: Phil Susi, Git Mailing List, Junio C Hamano, Philip Oakley,
	Johannes Schindelin, SZEDER Gábor

On Wed, May 20, 2015 at 11:02 AM, David Aguilar <davvid@gmail.com> wrote:

> git-sh-setup sets IFS but it is not used by git-difftool--helper.
> Set IFS in git-mergetool--lib so that the mergetool scriptlets,
> diftool, and mergetool do not need to do so.

s/diftool/difftool/

-- 
Sebastian Schuberth

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

end of thread, other threads:[~2015-05-20  9:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-20  9:02 [PATCH v5 1/2] mergetool--lib: set IFS for difftool and mergetool David Aguilar
2015-05-20  9:02 ` [PATCH v5 2/2] mergetools: add winmerge as a builtin tool David Aguilar
2015-05-20  9:04 ` [PATCH v5 1/2] mergetool--lib: set IFS for difftool and mergetool Sebastian Schuberth

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