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: John Keeping <john@keeping.me.uk>, git@vger.kernel.org
Subject: Re: [PATCH] mergetools: Simplify how we handle "vim" and "defaults"
Date: Sat, 26 Jan 2013 21:35:02 -0800	[thread overview]
Message-ID: <CAJDDKr692zbg+PiFWx1y81yn=s2e=C0pFhsup4z0uTRNOTMPwg@mail.gmail.com> (raw)
In-Reply-To: <CAJDDKr5cCbNi5q5_Ds-yohXR56ZfVs7YBTgJP3THjRx1=EgG9w@mail.gmail.com>

On Sat, Jan 26, 2013 at 9:07 PM, David Aguilar <davvid@gmail.com> wrote:
> On Sat, Jan 26, 2013 at 8:57 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> John Keeping <john@keeping.me.uk> writes:
>>
>>> I'm not sure creating an 'include' directory actually buys us much over
>>> declaring that 'vimdiff' is the real script and the others just source
>>> it.
>>
>> Is 'include' really used for such a purpose?  It only houses defaults.sh
>> as far as I can see.
>>
>> As that defaults.sh file is used only to define trivially empty
>> shell functions, I wonder if it is better to get rid of it, and
>> define these functions in line in git-mergetool--lib.sh.  Such a
>> change would like the attached on top of the entire series.
>
> I think that's much better.

Would you like me to put this together into a proper patch?

You can also squash it in (along with a removal of the
last line of the commit message) if you prefer.


>>  Makefile                       |  6 +-----
>>  git-mergetool--lib.sh          | 24 ++++++++++++++++++++++--
>>  mergetools/include/defaults.sh | 22 ----------------------
>>  3 files changed, 23 insertions(+), 29 deletions(-)
>>
>> diff --git a/Makefile b/Makefile
>> index 26f217f..f69979e 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -2724,11 +2724,7 @@ install: all
>>         $(INSTALL) $(install_bindir_programs) '$(DESTDIR_SQ)$(bindir_SQ)'
>>         $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
>>         $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
>> -       $(INSTALL) -m 644 $(filter-out mergetools/include,$(wildcard mergetools/*)) \
>> -               '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
>> -       $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mergetools_instdir_SQ)/include'
>> -       $(INSTALL) -m 644 mergetools/include/* \
>> -               '$(DESTDIR_SQ)$(mergetools_instdir_SQ)/include'
>> +       $(INSTALL) -m 644 mergetools/* '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
>>  ifndef NO_GETTEXT
>>         $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(localedir_SQ)'
>>         (cd po/build/locale && $(TAR) cf - .) | \
>> diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
>> index 7ea7510..1d0fb12 100644
>> --- a/git-mergetool--lib.sh
>> +++ b/git-mergetool--lib.sh
>> @@ -57,8 +57,28 @@ setup_tool () {
>>                 return 2
>>         fi
>>
>> -       # Load the default functions
>> -       . "$MERGE_TOOLS_DIR/include/defaults.sh"
>> +       # Fallback definitions, to be overriden by tools.
>> +       can_merge () {
>> +               return 0
>> +       }
>> +
>> +       can_diff () {
>> +               return 0
>> +       }
>> +
>> +       diff_cmd () {
>> +               status=1
>> +               return $status
>> +       }
>> +
>> +       merge_cmd () {
>> +               status=1
>> +               return $status
>> +       }
>> +
>> +       translate_merge_tool_path () {
>> +               echo "$1"
>> +       }
>>
>>         # Load the redefined functions
>>         . "$MERGE_TOOLS_DIR/$tool"
>> diff --git a/mergetools/include/defaults.sh b/mergetools/include/defaults.sh
>> deleted file mode 100644
>> index 21e63ec..0000000
>> --- a/mergetools/include/defaults.sh
>> +++ /dev/null
>> @@ -1,22 +0,0 @@
>> -# Redefined by builtin tools
>> -can_merge () {
>> -       return 0
>> -}
>> -
>> -can_diff () {
>> -       return 0
>> -}
>> -
>> -diff_cmd () {
>> -       status=1
>> -       return $status
>> -}
>> -
>> -merge_cmd () {
>> -       status=1
>> -       return $status
>> -}
>> -
>> -translate_merge_tool_path () {
>> -       echo "$1"
>> -}



-- 
David

  reply	other threads:[~2013-01-27  5:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-26  6:50 [PATCH] mergetools: Simplify how we handle "vim" and "defaults" David Aguilar
2013-01-26 12:12 ` John Keeping
2013-01-26 20:40   ` David Aguilar
2013-01-26 20:54     ` John Keeping
2013-01-27  4:57   ` Junio C Hamano
2013-01-27  5:07     ` David Aguilar
2013-01-27  5:35       ` David Aguilar [this message]
2013-01-27  6:05         ` 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='CAJDDKr692zbg+PiFWx1y81yn=s2e=C0pFhsup4z0uTRNOTMPwg@mail.gmail.com' \
    --to=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=john@keeping.me.uk \
    /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).