git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/2] mergetools: create mergetool_find_win32_cmd() helper function for winmerge

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 25, 2016, 23:00 UTC
Message-ID
<xmqqio0a17ux.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<1458946376-30296-2-git-send-email-jacob.nisnevich@gmail.com>
Jacob Nisnevich <jacob.nisnevich@gmail.com> writes:
Show 20 quoted lines
> Signed-off-by: Jacob Nisnevich <jacob.nisnevich@gmail.com>
> ---
>  git-mergetool--lib.sh | 25 +++++++++++++++++++++++++
>  mergetools/winmerge   | 21 +--------------------
>  2 files changed, 26 insertions(+), 20 deletions(-)
>
> diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
> index 54ac8e4..c5fa820 100644
> --- a/git-mergetool--lib.sh
> +++ b/git-mergetool--lib.sh
> @@ -372,3 +372,28 @@ get_merge_tool () {
>  	fi
>  	echo "$merge_tool"
>  }
> +
> +mergetool_find_win32_cmd () {
> +	executable=$1
> +	folder=$2
> +
> +	# Use executable.com if it exists in $PATH
s/executable.com/$executable/
> +	if type -p $executable >/dev/null 2>&1
This needs to be quoted,
	if type -p "$executable" >/dev/null 2>&1
> +	then
> +		printf '%s' $executable
Likewise.
Show 15 quoted lines
> +		return
> +	fi
> +
> +	# Look for executable in the typical locations
> +	for directory in $(env | grep -Ei '^PROGRAM(FILES(\(X86\))?|W6432)=' |
> +		cut -d '=' -f 2- | sort -u)
> +	do
> +		if test -n "$directory" && test -x "$directory/$folder/$executable"
> +		then
> +			printf '%s' "$directory/$folder/$executable"
> +			return
> +		fi
> +	done
> +
> +	printf '%s' $executable
Likewise.

Other than these points, I do not see anything wrong in this patch. Thanks.

By the way, "directory/folder/stuff" sounds somewhat strange, no?
Previous: Jacob NisnevichNext: Jacob Nisnevich
Message 14 of 20 in “mergetools: created new mergetool file for ExamDiff”
  1. mergetools: created new mergetool file for ExamDiffJacob Nisnevich, Mar 20, 2016
  2. Junio C HamanoMar 21, 2016
  3. David AguilarMar 21, 2016
  4. 0/2 Helper function for ExamDiff and Winmerge mergetoolsJacob Nisnevich, Mar 23, 2016
  5. 1/2 mergetools: created new mergetool file for ExamDiffJacob Nisnevich, Mar 23, 2016
  6. 2/2 created helper function for both winmerge and examdiff mergetoolsJacob Nisnevich, Mar 23, 2016
  7. Junio C HamanoMar 23, 2016
  8. mergetools: implemented new mergetool file for ExamDiffJacob Nisnevich, Mar 23, 2016
  9. mergetools: implemented new mergetool file for ExamDiffJacob Nisnevich, Mar 23, 2016
  10. David AguilarMar 24, 2016
  11. Junio C HamanoMar 24, 2016
  12. 0/2 add support for ExamDiffJacob Nisnevich, Mar 25, 2016
  13. 1/2 mergetools: create mergetool_find_win32_cmd() helper function for winmergeJacob Nisnevich, Mar 25, 2016
  14. Junio C HamanoMar 25, 2016
  15. 0/2 mergetools: add support for ExamDiffJacob Nisnevich, Mar 25, 2016
  16. 1/2 mergetools: create mergetool_find_win32_cmd() helper function for winmergeJacob Nisnevich, Mar 25, 2016
  17. 2/2 mergetools: add support for ExamDiffJacob Nisnevich, Mar 25, 2016
  18. Junio C HamanoApr 1, 2016
  19. David AguilarApr 2, 2016
  20. 2/2 mergetools: add support for ExamDiffJacob Nisnevich, Mar 25, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.