Skip to content

Commit 3f1c70f

Browse files
committed
Merge branch 'da/difftool-mergtool-refactor'
* da/difftool-mergtool-refactor: mergetools/meld: Use '--output' when available mergetool--lib: Refactor tools into separate files mergetool--lib: Make style consistent with git difftool--helper: Make style consistent with git
2 parents 9bf0eed + f61bd9c commit 3f1c70f

File tree

18 files changed

+432
-320
lines changed

18 files changed

+432
-320
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
@@ -2258,6 +2259,13 @@ endif
22582259
gitexec_instdir_SQ = $(subst ','\'',$(gitexec_instdir))
22592260
export gitexec_instdir
22602261

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

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

git-difftool--helper.sh

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ TOOL_MODE=diff
1313
should_prompt () {
1414
prompt_merge=$(git config --bool mergetool.prompt || echo true)
1515
prompt=$(git config --bool difftool.prompt || echo $prompt_merge)
16-
if test "$prompt" = true; then
16+
if test "$prompt" = true
17+
then
1718
test -z "$GIT_DIFFTOOL_NO_PROMPT"
1819
else
1920
test -n "$GIT_DIFFTOOL_PROMPT"
@@ -37,9 +38,11 @@ launch_merge_tool () {
3738

3839
# $LOCAL and $REMOTE are temporary files so prompt
3940
# the user with the real $MERGED name before launching $merge_tool.
40-
if should_prompt; then
41+
if should_prompt
42+
then
4143
printf "\nViewing: '$MERGED'\n"
42-
if use_ext_cmd; then
44+
if use_ext_cmd
45+
then
4346
printf "Hit return to launch '%s': " \
4447
"$GIT_DIFFTOOL_EXTCMD"
4548
else
@@ -48,16 +51,19 @@ launch_merge_tool () {
4851
read ans
4952
fi
5053

51-
if use_ext_cmd; then
54+
if use_ext_cmd
55+
then
5256
export BASE
5357
eval $GIT_DIFFTOOL_EXTCMD '"$LOCAL"' '"$REMOTE"'
5458
else
5559
run_merge_tool "$merge_tool"
5660
fi
5761
}
5862

59-
if ! use_ext_cmd; then
60-
if test -n "$GIT_DIFF_TOOL"; then
63+
if ! use_ext_cmd
64+
then
65+
if test -n "$GIT_DIFF_TOOL"
66+
then
6167
merge_tool="$GIT_DIFF_TOOL"
6268
else
6369
merge_tool="$(get_merge_tool)" || exit

0 commit comments

Comments
 (0)