git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "H.Merijn Brand" <h.m.brand@xs4all.nl>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: Feature request: be able to pass arguments to difftool command
Date: Wed, 29 Aug 2018 09:18:38 +0200	[thread overview]
Message-ID: <20180829091838.2eee8a6a@pc09.procura.nl> (raw)
In-Reply-To: <xmqqpny2ffjv.fsf@gitster-ct.c.googlers.com>

[-- Attachment #1: Type: text/plain, Size: 3342 bytes --]

On Tue, 28 Aug 2018 12:37:40 -0700, Junio C Hamano <gitster@pobox.com>
wrote:

> "H.Merijn Brand" <h.m.brand@xs4all.nl> writes:
> 
> > So, my wish would be to have an option, possibly using -- to pass
> > additional command line arguments to git difftool, so that
> >
> >  $ git difftool $commit~1..$commit -- -m -v2
> >
> > would pass the arguments after -- transparantly to ccdiff (in my case)  
> 
> At the syntax level passing any option after "--" would be a no
> starter, as I would imagine that "git difftool $revs -- $paths"
> should still be supported.
> 
> At the concept level, however, I can see why such a feature would be
> useful.  Perhaps
> 
>     $ git difftool --backend-option=-m --backend-option=-v2 HEAD
>     $ git mergetool --backend-option=--foo

This would mean I can just pass remaining arguments, like this?

--8<--- ~/bin/git-ccdiff
#!/usr/bin/env perl
use 5.18.3;
use warnings;

my $commit;

@ARGV && $ARGV[0] !~ m/^-/ and $commit = shift;

my @git = qw( git difftool );
defined $commit and push @git, "$commit~1..$commit";
system @git, @ARGV;
-->8---

> with appropriate way(s) [*1*] to make it easier to type (and
> implement) would be an acceptable avenue to pursue, I wonder?

I like it, as long as they are all separate options in the backend and
not available in one single variable that needs to be split

I can envision a configure variable like

  backends.options.separator = U+2063

so the backend can safely split on that itself. But I also see this as
overly complex en over-engineering

> [Footnote]
> 
> *1* There are various possible ways, not all of them are mutually
>     incompatible.
> 
>     a. Give a short-form synonym, e.g. -X, to "--backend-option";

I like it

>     b. Assume that backend option always begins with a dash and add
>        one when missing, e.g. -Xm becomes --backend-option=-m

I guess not: there might be tools that do not work like that, e.g.
xfreerdp changed all their rememberable and logic options to the weird
stupid syntax they use now, including mixing -, -- and +

 rdesktop -u user -p - -g 1280x1024 -a 16 -r clipboard:CLIPBOARD host

->

 xfreerdp -u user --from-stdin -g 1280x1024 -a 16 --plugin clipbrd host

->

 xfreerdp /u:user /from-stdin /size:1280x1024 /bpp:16 +clipboard /v:host

>     c. Allow giving multiple backend options on a single option and
>        split at whitespace, e.g. --backend-option="-m -v2"

That is the weak part in my workaround, as it will break on options like

  --backend-option='--config="/path/to/My Configuration/My Application"'

>     d. Allow difftool.$toolname.opts configuration variable that is
>        multi-valued, so you can say
> 
> 	git -c difftool.ccdiff.opts=-v2 -c difftool.ccdiff.opts=-m difftool

Hmm, maybe harder to explain, but why not

>        (of course, not necessarily from the command line but the
>        point is you could configure it)
> 
>     Some of these (e.g. b, c) may not be desirable, though.


-- 
H.Merijn Brand  http://tux.nl   Perl Monger  http://amsterdam.pm.org/
using perl5.00307 .. 5.29   porting perl5 on HP-UX, AIX, and openSUSE
http://mirrors.develooper.com/hpux/        http://www.test-smoke.org/
http://qa.perl.org   http://www.goldmark.org/jeff/stupid-disclaimers/

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2018-08-29  7:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-28 15:57 Feature request: be able to pass arguments to difftool command H.Merijn Brand
2018-08-28 19:37 ` Junio C Hamano
2018-08-29  7:18   ` H.Merijn Brand [this message]
2018-09-16  6:28     ` David Aguilar
2018-09-17 16:44       ` 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

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

  git send-email \
    --in-reply-to=20180829091838.2eee8a6a@pc09.procura.nl \
    --to=h.m.brand@xs4all.nl \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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.
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 NNTP newsgroup(s).