Skip to content

Commit bc7a96a

Browse files
davvidgitster
authored andcommitted
mergetool--lib: Refactor tools into separate files
Individual merge tools are now defined in a mergetools/$tool file which is sourced at runtime. The individual files are installed into $(git --exec-path)/mergetools/. New tools can be added by creating a new file instead of editing the git-mergetool--lib.sh scriptlet. http://thread.gmane.org/gmane.comp.version-control.git/134906/focus=135006 Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 240dc3e commit bc7a96a

File tree

17 files changed

+369
-333
lines changed

17 files changed

+369
-333
lines changed

Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ bindir = $(prefix)/$(bindir_relative)
302302
mandir = share/man
303303
infodir = share/info
304304
gitexecdir = libexec/git-core
305+
mergetoolsdir = $(gitexecdir)/mergetools
305306
sharedir = $(prefix)/share
306307
gitwebdir = $(sharedir)/gitweb
307308
template_dir = share/git-core/templates
@@ -2257,6 +2258,13 @@ endif
22572258
gitexec_instdir_SQ = $(subst ','\'',$(gitexec_instdir))
22582259
export gitexec_instdir
22592260

2261+
ifneq ($(filter /%,$(firstword $(mergetoolsdir))),)
2262+
mergetools_instdir = $(mergetoolsdir)
2263+
else
2264+
mergetools_instdir = $(prefix)/$(mergetoolsdir)
2265+
endif
2266+
mergetools_instdir_SQ = $(subst ','\'',$(mergetools_instdir))
2267+
22602268
install_bindir_programs := $(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X)) $(BINDIR_PROGRAMS_NO_X)
22612269

22622270
install: all
@@ -2266,6 +2274,9 @@ install: all
22662274
$(INSTALL) -m 644 $(SCRIPT_LIB) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
22672275
$(INSTALL) $(install_bindir_programs) '$(DESTDIR_SQ)$(bindir_SQ)'
22682276
$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
2277+
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
2278+
(cd mergetools && $(TAR) cf - .) | \
2279+
(cd '$(DESTDIR_SQ)$(mergetools_instdir_SQ)' && umask 022 && $(TAR) xof -)
22692280
ifndef NO_PERL
22702281
$(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install
22712282
$(MAKE) -C gitweb install

0 commit comments

Comments
 (0)