Subject: Re: [PATCH v6] Support auto-merge for meld to follow the vim-diff behavior

From: Đoàn Trần Công Danh <[email-masked]>
Date: Fri, 3 Jul 2020 22:58:12 +0700

On 2020-07-02 18:50:15-0700, Junio C Hamano <[email-masked]> wrote:
> So, if we do not know yet, then...
> 
> >  	then
> > +		meld_use_auto_merge_option=$(git config mergetool.meld.useAutoMerge)
> > +		case "$meld_use_auto_merge_option" in
> > +		[Tt]rue|[Yy]es|[Oo]n|1)
> > +			meld_use_auto_merge_option=true
> 
> This is sloppy.  TRUE is also a valid way to spell 'yes'.
> 
>     if o=$(git config --bool 2>/dev/null mergetool.meld.useautomerge)
>     then
>     	meld_use_auto_merge_option=$o
>     elif test auto = "$(git config mergetool.meld.useautomerge)"
>     then
> 	... auto detect ...
>     else
> 	meld_use_auto_merge_option=false
>     fi

Something like this should work if we don't write anything to stderr,
except the complain from git-config:

> fatal: bad numeric config value 'auto' for 'mergetool.meld.useautomerge': invalid unit

	if o=$(git config --bool mergetool.meld.useautomerge 2>&1)
	then
		meld_use_auto_merge_option=$o
	else
		case "$o" in
		*"'auto'"*) ... auto detect ... ;;
		esac
	fi

This code block is likely broken if git-config is chatty (trace).
I don't know if we have a reliable ways to tell Git to not chatty,
though.

-- 
Danh