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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



David Aguilar, 16.01.2009:

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

> 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

> +	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

> 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]

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

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

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

> +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 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux