git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Aguilar <davvid@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Denton Liu <liu.denton@gmail.com>,
	git@vger.kernel.org, anmolmago@gmail.com, briankyho@gmail.com,
	david.lu97@outlook.com, shirui.wang@hotmail.com
Subject: Re: [PATCH 1/2] mergetool: Accept -g/--[no-]gui as arguments
Date: Tue, 23 Oct 2018 22:44:16 -0700	[thread overview]
Message-ID: <20181024053656.GA2985@gmail.com> (raw)
In-Reply-To: <xmqqy3aond55.fsf@gitster-ct.c.googlers.com>

On Wed, Oct 24, 2018 at 02:10:14PM +0900, Junio C Hamano wrote:
> Denton Liu <liu.denton@gmail.com> writes:
> 
> > Subject: Re: [PATCH 1/2] mergetool: Accept -g/--[no-]gui as arguments
> 
> Other people may point it out, but s/Accept/accept/.
> 
> > In line with how difftool accepts a -g/--[no-]gui option, make mergetool
> > accept the same option in order to use the `merge.guitool` variable to
> > find the default mergetool instead of `merge.tool`.
> > ...
> > diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
> > index 9a8b97a2a..e317ae003 100644
> > --- a/git-mergetool--lib.sh
> > +++ b/git-mergetool--lib.sh
> > @@ -350,17 +350,23 @@ guess_merge_tool () {
> >  }
> >  
> >  get_configured_merge_tool () {
> > -	# Diff mode first tries diff.tool and falls back to merge.tool.
> > -	# Merge mode only checks merge.tool
> > +	# If first argument is true, find the guitool instead
> > +	if [ "$1" = true ]
> 
> Don't use [] in our shell script (see Documentation/CodingGuidelines);
> say
> 
> 	if "$1" = true
> 
> instead.

Perhaps a small typo dropped "test" -- I think it should be

	if test "$1" = true


> > +	# Diff mode first tries diff.(gui)tool and falls back to merge.(gui)tool.
> > +	# Merge mode only checks merge.(gui)tool
> >  	if diff_mode
> >  	then
> > -		merge_tool=$(git config diff.tool || git config merge.tool)
> > +		merge_tool=$(git config diff.${gui_prefix}tool || git config merge.${gui_prefix}tool)
> >  	else
> > -		merge_tool=$(git config merge.tool)
> > +		merge_tool=$(git config merge.${gui_prefix}tool)
> >  	fi
> 
> In mode_ok shell function, we seem to be prepared to deal with a
> case where neither diff_mode nor merge_mode is true.  Should this
> codepath also be prepared to?  
> 
> This is not a comment to point out an issue with this patch.  It is
> a genuine question on the code after (or before for that matter)
> this patch is applied.
> 
> Thanks.


I think the code is okay.  mode_ok is setup that way to allow filtering
for the other mode's tools, but this code path is only concerned with
getting the default merge tool, which should only ever happen in one of
the two modes.

The bit about difftool falling back to mergetool's config is a
convenience so it does make sense to keep that for guitool as well.

The code after this part should handle merge_tool being empty just fine,
so once the `[ ... ]` vs `test` bit is updated, please feel free to add:

Acked-by: David Aguilar <davvid@gmail.com>


cheers,
-- 
David

  parent reply	other threads:[~2018-10-24  5:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-24  2:25 [PATCH 1/2] mergetool: Accept -g/--[no-]gui as arguments Denton Liu
2018-10-24  5:10 ` Junio C Hamano
2018-10-24  5:30   ` Denton Liu
2018-10-24  5:44   ` David Aguilar [this message]
2018-10-24  5:58   ` [PATCH v2 1/2] mergetool: accept " Denton Liu
2018-10-24 16:25     ` [PATCH v3 0/3] Add --gui to mergetool Denton Liu
2018-10-24 16:25       ` [PATCH v3 1/3] mergetool: accept -g/--[no-]gui as arguments Denton Liu
2018-10-24 16:25       ` [PATCH v3 2/3] completion: support `git mergetool --[no-]gui` Denton Liu
2018-10-24 16:25       ` [PATCH v3 3/3] doc: document diff/merge.guitool config keys Denton Liu
2018-10-26  6:11       ` [RESEND PATCH v3 0/3] Add --gui to mergetool Denton Liu
2018-10-26 13:15         ` Junio C Hamano
2018-10-26  6:11       ` [RESEND PATCH v3 1/3] mergetool: accept -g/--[no-]gui as arguments Denton Liu
2018-10-26  6:11       ` [RESEND PATCH v3 2/3] completion: support `git mergetool --[no-]gui` Denton Liu
2018-10-26  6:11       ` [RESEND PATCH v3 3/3] doc: document diff/merge.guitool config keys Denton Liu
2018-10-24  5:58   ` [PATCH v2 2/2] completion: support `git mergetool --[no-]gui` Denton Liu

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=20181024053656.GA2985@gmail.com \
    --to=davvid@gmail.com \
    --cc=anmolmago@gmail.com \
    --cc=briankyho@gmail.com \
    --cc=david.lu97@outlook.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=liu.denton@gmail.com \
    --cc=shirui.wang@hotmail.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).