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
David Aguilar <davvid@gmail.com>
Date
Jan 19, 2009, 00:34 UTC
Message-ID
<402731c90901181634u32b39c87t6e88d9efef0d3485@mail.gmail.com>
In-Reply-To
<200901182025.24045.markus.heidelberg@web.de>

On Sun, Jan 18, 2009 at 11:25 AM, Markus Heidelberg <markus.heidelberg@web.de> wrote:

Show 7 quoted lines
> David Aguilar, 16.01.2009:
>
>> +# 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
Thanks for catching that.
Show 6 quoted lines
>> +sub usage
>> +{
>> +     print << 'USAGE';
>> +
>
> Why the leading empty line?
Fixed.
Show 6 quoted lines
>> +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.
Done.
Show 13 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

Very cool. When you have unstaged changes git diff sends the local filename as the 2nd argument so I changed the vim command to "wincmd r" so that vim places the cursor on the right hand side.

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

I was wondering about that. I think I tried to follow the lead from the git-diff.txt documentation, but "diff" is a builtin and thus doesn't have an actual git-diff, so I see why they should be different.

I've changed the docs as you suggested -- 'git-difftool' is used to name the script while 'git difftool' is used in the SYNOPSIS section.

Show 14 quoted lines
>> +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]
Oops, I don't know how that happened.
Show 5 quoted lines
>
> Works fine for me, thanks.
>
> Markus
>
Thanks again for your help.
-- 
    David
Previous: Markus HeidelbergNext: Markus Heidelberg
Message 5 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.