git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: David Aguilar <davvid@gmail.com>
To: Nicholas Guriev <nicholas@guriev.su>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [RFC PATCH] mergetools: support difftool.tabbed setting
Date: Thu, 11 Feb 2021 21:51:24 -0800	[thread overview]
Message-ID: <CAJDDKr4zM1ZuNc+JpQnAtqwa5Ljv7_5bL3X-cC3e5Xg3z2Cbcw@mail.gmail.com> (raw)
In-Reply-To: <2fb58fd30ae730ccd3e88ec51b5fe6d80ab7a8c7.camel@guriev.su>

On Tue, Jan 12, 2021 at 10:07 PM Nicholas Guriev <nicholas@guriev.su> wrote:
>
> I was asked how to configure "git difftool" to open files using several
> tabs and stop spawning diff application on every modified file. I looked
> into Git source and found no possibility to run diff tool at one step.
>
> The patch allows a user to view diffs in single window at one go. The
> current implementation is still poor and it can be used solely for
> demonstration purposes. To see it in action, tweak the local gitconfig:
>
>     git config difftool.prompt false
>     git config difftool.tabbed true
>
> Then run:
>
>     git difftool -t vimdiff
>
> Or:
>
>     git difftool -t meld
>
> The solution has some restrictions, diffing up to ten files works now (I
> did not bother with dynamic memory allocation), and it does not handle spaces
> in file names (I do not know how to pass them correctly to underlying tools
> without "xargs -0").
>
> I think the git-difftool--helper should be changed so that it could
> process many files in single invocation and it would not use a temporary
> file by itself. A similar behaviour can be done in git-mergetool, too.
>
> Do you have ideas how to better implement such a feature? Any comments
> are welcome.
>
> P.S.: I'm attaching screenshots for a clear demo what I mean.
> ---
>  diff.c                |  4 ++--
>  git-mergetool--lib.sh | 36 +++++++++++++++++++++++++++++++++++-
>  mergetools/meld       |  4 ++++
>  mergetools/vimdiff    | 17 +++++++++++++++++
>  4 files changed, 58 insertions(+), 3 deletions(-)
>
>
>

I'm not really sure if "tabbed" is the best name for what's going on,
though.  It's really more of a "diff everything in one shot" mode, and
it just so happens that the tools in question use tabs.

General note -- similar to the convention followed by
mergetool.hideResolved and other difftool things I think it would make
sense for tools to be able to override this on a per-tool basis.

That said, I wonder whether we need this new feature, or whether we
should instead improve an existing one.  I'm leaning towards improving
the existing dir-diff feature as a better alternative.

It's unfortunate that the "git difftool --dir-diff" feature doesn't
seem to mesh well with vimdiff.  It does work well with other tools
that support diffing arbitrary directories, notably meld, xxdiff, etc.

Regarding vimdiff + git difftool -d, there is this advice:
https://stackoverflow.com/questions/8156493/git-vimdiff-and-dirdiff

meld works just fine with "git difftool -d" (arguably nicer, since it
gives you a directory view and a diff view in separate tabs), so if
the only improvement is for vimdiff, then maybe the advice with the
DirDiff plugin might be a better way to go.

Having something like a "difftool.vimdiff.useDirDiff" configuration
variable could be a way for us to adopt the advice that they offer
there.  We could have the dir-diff difftool mode set a variable that
the vimdiff scriptlet could use to detect that we're in dir-diff mode.
Then, when that variable is set, vimdiff could use,

    vim -f '+next' '+execute \"DirDiff\" argv(0) argv(1)' $LOCAL $REMOTE

(as mentioned in the SO page) to invoke dir-diff mode in vim.

That way the user only needs to set:

git config difftool.vimdiff.useDirDiff

... and then "git diffftool -d" will integrate with the DirDiff plugin.

What do you think about improving the vimdiff scriptlet to better
integrate with "git difftool -d" instead?
-- 
David

  parent reply	other threads:[~2021-02-12  5:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-13  5:59 [RFC PATCH] mergetools: support difftool.tabbed setting Nicholas Guriev
2021-01-18 21:00 ` [RFC PATCH v2 0/3] implement tabbed mode in difftools Nicholas Guriev
2021-01-18 21:00   ` [RFC PATCH v2 1/3] mergetools: support difftool.tabbed setting Nicholas Guriev
2021-01-18 23:25     ` Junio C Hamano
2021-01-18 21:00   ` [RFC PATCH v2 2/3] difftool-helper: conciliate difftool.tabbed and difftool.prompt settings Nicholas Guriev
2021-01-18 21:00   ` [RFC PATCH v2 3/3] doc: describe new difftool.tabbed feature Nicholas Guriev
2021-01-25 21:21   ` [PATCH v3 0/4] difftools in tabbed mode Nicholas Guriev
2021-01-25 21:21     ` [PATCH v3 1/4] mergetools: support difftool.tabbed setting Nicholas Guriev
2021-01-25 21:21     ` [PATCH v3 2/4] difftool-helper: conciliate difftool.tabbed and difftool.prompt settings Nicholas Guriev
2021-01-25 23:04       ` Junio C Hamano
2021-01-25 21:21     ` [PATCH v3 3/4] doc: describe new difftool.tabbed feature Nicholas Guriev
2021-01-25 21:21     ` [PATCH v3 4/4] t7800: new tests of " Nicholas Guriev
2021-02-12  5:51 ` David Aguilar [this message]
2021-02-12 22:21   ` [RFC PATCH] mergetools: support difftool.tabbed setting Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJDDKr4zM1ZuNc+JpQnAtqwa5Ljv7_5bL3X-cC3e5Xg3z2Cbcw@mail.gmail.com \
    --to=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=nicholas@guriev.su \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).