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

Re: [PATCH] contrib: add 'git difftool' for launching common merge tools

From
Markus Heidelberg <markus.heidelberg@web.de>
Date
Jan 18, 2009, 19:25 UTC
Message-ID
<200901182025.24045.markus.heidelberg@web.de>
In-Reply-To
<1232092802-30838-1-git-send-email-davvid@gmail.com>
David Aguilar, 16.01.2009:
Show 13 quoted lines
> diff --git a/contrib/difftool/git-difftool b/contrib/difftool/git-difftool
> new file mode 100755
> index 0000000..1fc087c
> --- /dev/null
> +++ b/contrib/difftool/git-difftool
> @@ -0,0 +1,74 @@
> +#!/usr/bin/env perl
> +# Copyright (c) 2009 David Aguilar
> +#
> +# This is a wrapper around the GIT_EXTERNAL_DIFF-compatible
> +# git-difftool-helper script.  This script exports
> +# GIT_EXTERNAL_DIFF and GIT_PAGER for use by git, and
> +# GIT_NO_PROMPT and GIT_MERGE_TOOL for use by git-difftool-helper.
GIT_DIFFTOOL_NO_PROMPT
> +sub usage
> +{
> +	print << 'USAGE';
> +
Why the leading empty line?
> +usage: git difftool [--no-prompt] [--tool=tool] ["git diff" options]
--tool=<tool>

Swap the order of --no-prompt and --tool for consistency with git-difftool.txt and git-mergetool.

Show 5 quoted lines
> diff --git a/contrib/difftool/git-difftool-helper b/contrib/difftool/git-difftool-helper
> new file mode 100755
> index 0000000..0b266e3
> --- /dev/null
> +++ b/contrib/difftool/git-difftool-helper
Show 7 quoted lines
> +	meld|vimdiff)
> +		"$merge_tool_path" "$LOCAL" "$REMOTE"
> +		;;
> +
> +	gvimdiff)
> +		"$merge_tool_path" -f "$LOCAL" "$REMOTE"
> +		;;

Maybe use '-c "wincmd l"' for Vim as in my patch for git-mergetool to automatically place the cursor in the editable file? Useful for editing, if git-difftool is used to diff a file from the working tree.

See http://thread.gmane.org/gmane.comp.version-control.git/106109
Show 5 quoted lines
> diff --git a/contrib/difftool/git-difftool.txt b/contrib/difftool/git-difftool.txt
> new file mode 100644
> index 0000000..3940c70
> --- /dev/null
> +++ b/contrib/difftool/git-difftool.txt

You have deleted all the '-' chars from git-command, but when using it as the name I think it's the preferred method, only when used as command then without slash.

> +DESCRIPTION
> +-----------
> +'git difftool' is a git command that allows you to compare and edit files

If for example 'git difftool' is used as the name of the tool and not the command, I think the dash should be kept.

> +between revisions using common merge tools.  At its most basic level,
> +'git difftool' does what 'git mergetool' does but its use is for non-merge
Keep the dash.
> +situations such as when preparing commits or comparing changes against
> +the index.
> +
> +'git difftool' is a frontend to 'git diff' and accepts the same
Keep the dash.
> +arguments and options.
> +
> +See linkgit:git-diff[7] for the full list of supported options.
[1]
Show 10 quoted lines
> +
> +OPTIONS
> +-------
> +-t <tool>::
> +--tool=<tool>::
> +	Use the merge resolution program specified by <tool>.
> +	Valid merge tools are:
> +	kdiff3, tkdiff, meld, xxdiff, emerge, vimdiff, gvimdiff, ecmerge, and opendiff
> ++
> +If a merge resolution program is not specified, 'git difftool'
Keep the dash.
> +situations such as when preparing commits or comparing changes against
> +will use the configuration variable `merge.tool`.  If the
> +configuration variable `merge.tool` is not set, 'git difftool'
Keep the dash.
Show 7 quoted lines
> +situations such as when preparing commits or comparing changes against
> +will pick a suitable default.
> ++
> +You can explicitly provide a full path to the tool by setting the
> +configuration variable `mergetool.<tool>.path`. For example, you
> +can configure the absolute path to kdiff3 by setting
> +`mergetool.kdiff3.path`. Otherwise, 'git difftool' assumes the
Keep the dash.
Show 5 quoted lines
> +situations such as when preparing commits or comparing changes against
> +tool is available in PATH.
> ++
> +Instead of running one of the known merge tool programs,
> +'git difftool' can be customized to run an alternative program
Keep the dash.
Show 5 quoted lines
> +situations such as when preparing commits or comparing changes against
> +by specifying the command line to invoke in a configuration
> +variable `mergetool.<tool>.cmd`.
> ++
> +When 'git difftool' is invoked with this tool (either through the
Keep the dash.
> +--no-prompt::
> +	Do not prompt before launching a merge tool.
the diff tool
> +SEE ALSO
> +--------
> +linkgit:git-diff[7]::
[1]
Show 6 quoted lines
> +	 Show changes between commits, commit and working tree, etc
> +
> +linkgit:git-mergetool[1]::
> +	Run merge conflict resolution tools to resolve merge conflicts
> +
> +linkgit:git-config[7]::
[1]
Works fine for me, thanks.
Markus
Previous: David AguilarNext: David Aguilar
Message 2 of 7 in “contrib: add 'git difftool' for launching common merge tools”
  1. contrib: add 'git difftool' for launching common merge toolsDavid Aguilar, Jan 16, 2009
  2. Markus HeidelbergJan 18, 2009
  3. contrib: add 'git-difftool' for launching common diff toolsDavid Aguilar, Jan 19, 2009
  4. Markus HeidelbergJan 19, 2009
  5. David AguilarJan 19, 2009
  6. Markus HeidelbergJan 19, 2009
  7. David AguilarJan 19, 2009

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.