Skip to content

Commit

Permalink
Merge branch 'da/difftool-mergtool-refactor'
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Junio C Hamano committed Aug 25, 2011
2 parents 9bf0eed + f61bd9c commit 3f1c70f
Show file tree
Hide file tree
Showing 18 changed files with 432 additions and 320 deletions.
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ bindir = $(prefix)/$(bindir_relative)
mandir = share/man
infodir = share/info
gitexecdir = libexec/git-core
mergetoolsdir = $(gitexecdir)/mergetools
sharedir = $(prefix)/share
gitwebdir = $(sharedir)/gitweb
template_dir = share/git-core/templates
Expand Down Expand Up @@ -2258,6 +2259,13 @@ endif
gitexec_instdir_SQ = $(subst ','\'',$(gitexec_instdir))
export gitexec_instdir

ifneq ($(filter /%,$(firstword $(mergetoolsdir))),)
mergetools_instdir = $(mergetoolsdir)
else
mergetools_instdir = $(prefix)/$(mergetoolsdir)
endif
mergetools_instdir_SQ = $(subst ','\'',$(mergetools_instdir))

install_bindir_programs := $(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X)) $(BINDIR_PROGRAMS_NO_X)

install: all
Expand All @@ -2267,6 +2275,9 @@ install: all
$(INSTALL) -m 644 $(SCRIPT_LIB) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
$(INSTALL) $(install_bindir_programs) '$(DESTDIR_SQ)$(bindir_SQ)'
$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
(cd mergetools && $(TAR) cf - .) | \
(cd '$(DESTDIR_SQ)$(mergetools_instdir_SQ)' && umask 022 && $(TAR) xof -)
ifndef NO_PERL
$(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install
$(MAKE) -C gitweb install
Expand Down
18 changes: 12 additions & 6 deletions git-difftool--helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ TOOL_MODE=diff
should_prompt () {
prompt_merge=$(git config --bool mergetool.prompt || echo true)
prompt=$(git config --bool difftool.prompt || echo $prompt_merge)
if test "$prompt" = true; then
if test "$prompt" = true
then
test -z "$GIT_DIFFTOOL_NO_PROMPT"
else
test -n "$GIT_DIFFTOOL_PROMPT"
Expand All @@ -37,9 +38,11 @@ launch_merge_tool () {

# $LOCAL and $REMOTE are temporary files so prompt
# the user with the real $MERGED name before launching $merge_tool.
if should_prompt; then
if should_prompt
then
printf "\nViewing: '$MERGED'\n"
if use_ext_cmd; then
if use_ext_cmd
then
printf "Hit return to launch '%s': " \
"$GIT_DIFFTOOL_EXTCMD"
else
Expand All @@ -48,16 +51,19 @@ launch_merge_tool () {
read ans
fi

if use_ext_cmd; then
if use_ext_cmd
then
export BASE
eval $GIT_DIFFTOOL_EXTCMD '"$LOCAL"' '"$REMOTE"'
else
run_merge_tool "$merge_tool"
fi
}

if ! use_ext_cmd; then
if test -n "$GIT_DIFF_TOOL"; then
if ! use_ext_cmd
then
if test -n "$GIT_DIFF_TOOL"
then
merge_tool="$GIT_DIFF_TOOL"
else
merge_tool="$(get_merge_tool)" || exit
Expand Down
Loading

0 comments on commit 3f1c70f

Please sign in to comment.