Merge branch 'da/difftool'
authorJunio C Hamano <gitster@pobox.com>
Sat, 18 Apr 2009 04:42:12 +0000 (21:42 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sat, 18 Apr 2009 04:42:12 +0000 (21:42 -0700)
* da/difftool:
mergetool--lib: simplify API usage by removing more global variables
Fix misspelled mergetool.keepBackup
difftool/mergetool: refactor commands to use git-mergetool--lib
mergetool: use $( ... ) instead of `backticks`
bash completion: add git-difftool
difftool: add support for a difftool.prompt config variable
difftool: add various git-difftool tests
difftool: move 'git-difftool' out of contrib
difftool/mergetool: add diffuse as merge and diff tool
difftool: add a -y shortcut for --no-prompt
difftool: use perl built-ins when testing for msys
difftool: remove the backup file feature
difftool: remove merge options for opendiff, tkdiff, kdiff3 and xxdiff
git-mergetool: add new merge tool TortoiseMerge
git-mergetool/difftool: make (g)vimdiff workable under Windows
doc/merge-config: list ecmerge as a built-in merge tool

1  2 
.gitignore
Documentation/config.txt
Makefile
contrib/completion/git-completion.bash
diff --combined .gitignore
index 16f7a97d9711acd9f9bd2397eccde191f00b3254,757c7f0ad9461747563cd680877e9a15f96a49e6..41c0b20a76ce0fd47c7cafc51777336ce99ce1b0
@@@ -11,7 -11,6 +11,7 @@@ git-appl
  git-archimport
  git-archive
  git-bisect
 +git-bisect--helper
  git-blame
  git-branch
  git-bundle
@@@ -36,6 -35,8 +36,8 @@@ git-dif
  git-diff-files
  git-diff-index
  git-diff-tree
+ git-difftool
+ git-difftool--helper
  git-describe
  git-fast-export
  git-fast-import
@@@ -79,6 -80,7 +81,7 @@@ git-merge-recursiv
  git-merge-resolve
  git-merge-subtree
  git-mergetool
+ git-mergetool--lib
  git-mktag
  git-mktree
  git-name-rev
diff --combined Documentation/config.txt
index f3ebd2f9a048371e7d519a93ea9c7eaf3bc75e2d,d427dafb41a5688804ad81dfbe938b37776877c9..5319df5058a39354d9fa446110dbb5e15e55101c
@@@ -667,6 -667,27 +667,27 @@@ diff.suppressBlankEmpty:
        A boolean to inhibit the standard behavior of printing a space
        before each empty output line. Defaults to false.
  
+ diff.tool::
+       Controls which diff tool is used.  `diff.tool` overrides
+       `merge.tool` when used by linkgit:git-difftool[1] and has
+       the same valid values as `merge.tool` minus "tortoisemerge"
+       and plus "kompare".
+ difftool.<tool>.path::
+       Override the path for the given tool.  This is useful in case
+       your tool is not in the PATH.
+ difftool.<tool>.cmd::
+       Specify the command to invoke the specified diff tool.
+       The specified command is evaluated in shell with the following
+       variables available:  'LOCAL' is set to the name of the temporary
+       file containing the contents of the diff pre-image and 'REMOTE'
+       is set to the name of the temporary file containing the contents
+       of the diff post-image.
+ difftool.prompt::
+       Prompt before each invocation of the diff tool.
  diff.wordRegex::
        A POSIX Extended Regular Expression used to determine what is a "word"
        when performing word-by-word difference calculations.  Character
@@@ -1215,7 -1236,7 +1236,7 @@@ push.default:
  * `matching` push all matching branches.
    All branches having the same name in both ends are considered to be
    matching. This is the default.
 -* `tracking` push the current branch to the branch it is tracking.
 +* `tracking` push the current branch to its upstream branch.
  * `current` push the current branch to a branch of the same name.
  
  rebase.stat::
diff --combined Makefile
index 7c8763710c12350589e9a39815c8ad34a5054c37,3e56274d36e9ac83291554c782ac9173741ed166..57f9f2625431b4ab89cb2e17fb866dd4f29b8905
+++ b/Makefile
@@@ -145,8 -145,6 +145,8 @@@ all:
  # Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's
  # MakeMaker (e.g. using ActiveState under Cygwin).
  #
 +# Define NO_PERL if you do not want Perl scripts or libraries at all.
 +#
  # Define NO_TCLTK if you do not want Tcl/Tk GUI.
  #
  # The TCL_PATH variable governs the location of the Tcl interpreter
@@@ -279,12 -277,14 +279,14 @@@ TEST_PROGRAMS 
  
  SCRIPT_SH += git-am.sh
  SCRIPT_SH += git-bisect.sh
+ SCRIPT_SH += git-difftool--helper.sh
  SCRIPT_SH += git-filter-branch.sh
  SCRIPT_SH += git-lost-found.sh
  SCRIPT_SH += git-merge-octopus.sh
  SCRIPT_SH += git-merge-one-file.sh
  SCRIPT_SH += git-merge-resolve.sh
  SCRIPT_SH += git-mergetool.sh
+ SCRIPT_SH += git-mergetool--lib.sh
  SCRIPT_SH += git-parse-remote.sh
  SCRIPT_SH += git-pull.sh
  SCRIPT_SH += git-quiltimport.sh
@@@ -298,6 -298,7 +300,7 @@@ SCRIPT_SH += git-submodule.s
  SCRIPT_SH += git-web--browse.sh
  
  SCRIPT_PERL += git-add--interactive.perl
+ SCRIPT_PERL += git-difftool.perl
  SCRIPT_PERL += git-archimport.perl
  SCRIPT_PERL += git-cvsexportcommit.perl
  SCRIPT_PERL += git-cvsimport.perl
@@@ -355,10 -356,7 +358,10 @@@ BUILT_INS += git-whatchanged$
  ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
  
  # what 'all' will build but not install in gitexecdir
 -OTHER_PROGRAMS = git$X gitweb/gitweb.cgi
 +OTHER_PROGRAMS = git$X
 +ifndef NO_PERL
 +OTHER_PROGRAMS += gitweb/gitweb.cgi
 +endif
  
  # Set paths to tools early so that they can be used for version tests.
  ifndef SHELL_PATH
@@@ -437,7 -435,6 +440,7 @@@ LIB_OBJS += archive-tar.
  LIB_OBJS += archive-zip.o
  LIB_OBJS += attr.o
  LIB_OBJS += base85.o
 +LIB_OBJS += bisect.o
  LIB_OBJS += blob.o
  LIB_OBJS += branch.o
  LIB_OBJS += bundle.o
@@@ -538,7 -535,6 +541,7 @@@ BUILTIN_OBJS += builtin-add.
  BUILTIN_OBJS += builtin-annotate.o
  BUILTIN_OBJS += builtin-apply.o
  BUILTIN_OBJS += builtin-archive.o
 +BUILTIN_OBJS += builtin-bisect--helper.o
  BUILTIN_OBJS += builtin-blame.o
  BUILTIN_OBJS += builtin-branch.o
  BUILTIN_OBJS += builtin-bundle.o
@@@ -1111,10 -1107,6 +1114,10 @@@ ifeq ($(TCLTK_PATH),
  NO_TCLTK=NoThanks
  endif
  
 +ifeq ($(PERL_PATH),)
 +NO_PERL=NoThanks
 +endif
 +
  QUIET_SUBDIR0  = +$(MAKE) -C # space to separate -C and subdir
  QUIET_SUBDIR1  =
  
@@@ -1189,9 -1181,7 +1192,9 @@@ ifndef NO_TCLT
        $(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) gitexecdir='$(gitexec_instdir_SQ)' all
        $(QUIET_SUBDIR0)gitk-git $(QUIET_SUBDIR1) all
  endif
 +ifndef NO_PERL
        $(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' all
 +endif
        $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1)
  
  please_set_SHELL_PATH_to_a_more_modern_shell:
@@@ -1204,7 -1194,6 +1207,7 @@@ strip: $(PROGRAMS) git$
  
  git.o: git.c common-cmds.h GIT-CFLAGS
        $(QUIET_CC)$(CC) -DGIT_VERSION='"$(GIT_VERSION)"' \
 +              '-DGIT_HTML_PATH="$(htmldir_SQ)"' \
                $(ALL_CFLAGS) -c $(filter %.c,$^)
  
  git$X: git.o $(BUILTIN_OBJS) $(GITLIBS)
@@@ -1239,7 -1228,6 +1242,7 @@@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %
        chmod +x $@+ && \
        mv $@+ $@
  
 +ifndef NO_PERL
  $(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak
  
  perl/perl.mak: GIT-CFLAGS perl/Makefile perl/Makefile.PL
@@@ -1299,15 -1287,6 +1302,15 @@@ git-instaweb: git-instaweb.sh gitweb/gi
            $@.sh > $@+ && \
        chmod +x $@+ && \
        mv $@+ $@
 +else # NO_PERL
 +$(patsubst %.perl,%,$(SCRIPT_PERL)) git-instaweb: % : unimplemented.sh
 +      $(QUIET_GEN)$(RM) $@ $@+ && \
 +      sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
 +          -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
 +          unimplemented.sh >$@+ && \
 +      chmod +x $@+ && \
 +      mv $@+ $@
 +endif # NO_PERL
  
  configure: configure.ac
        $(QUIET_GEN)$(RM) $@ $<+ && \
@@@ -1424,7 -1403,6 +1427,7 @@@ GIT-BUILD-OPTIONS: .FORCE-GIT-BUILD-OPT
        @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@
        @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@
        @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@
 +      @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@
  
  ### Detect Tck/Tk interpreter path changes
  ifndef NO_TCLTK
@@@ -1627,11 -1605,9 +1630,11 @@@ clean
        $(RM) -r $(GIT_TARNAME) .doc-tmp-dir
        $(RM) $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
        $(RM) $(htmldocs).tar.gz $(manpages).tar.gz
 -      $(RM) gitweb/gitweb.cgi
        $(MAKE) -C Documentation/ clean
 +ifndef NO_PERL
 +      $(RM) gitweb/gitweb.cgi
        $(MAKE) -C perl clean
 +endif
        $(MAKE) -C templates/ clean
        $(MAKE) -C t/ clean
  ifndef NO_TCLTK
index c1c879821dc5c6314346d8c55c79fafdf48b5ac1,069e19e82a4e4fb092b41c835bf533fd1a02c650..1a90cb87f58b9595c3399793c26791557c9704f9
@@@ -910,6 -910,26 +910,26 @@@ _git_diff (
        __git_complete_file
  }
  
+ __git_mergetools_common="diffuse ecmerge emerge kdiff3 meld opendiff
+                       tkdiff vimdiff gvimdiff xxdiff
+ "
+ _git_difftool ()
+ {
+       local cur="${COMP_WORDS[COMP_CWORD]}"
+       case "$cur" in
+       --tool=*)
+               __gitcomp "$__git_mergetools_common kompare" "" "${cur##--tool=}"
+               return
+               ;;
+       --*)
+               __gitcomp "--tool="
+               return
+               ;;
+       esac
+       COMPREPLY=()
+ }
  __git_fetch_options="
        --quiet --verbose --append --upload-pack --force --keep --depth=
        --tags --no-tags
@@@ -1172,10 -1192,7 +1192,7 @@@ _git_mergetool (
        local cur="${COMP_WORDS[COMP_CWORD]}"
        case "$cur" in
        --tool=*)
-               __gitcomp "
-                       kdiff3 tkdiff meld xxdiff emerge
-                       vimdiff gvimdiff ecmerge opendiff
-                       " "" "${cur##--tool=}"
+               __gitcomp "$__git_mergetools_common tortoisemerge" "" "${cur##--tool=}"
                return
                ;;
        --*)
@@@ -1871,7 -1888,6 +1888,7 @@@ _git (
                        --bare
                        --version
                        --exec-path
 +                      --html-path
                        --work-tree=
                        --help
                        "
        config)      _git_config ;;
        describe)    _git_describe ;;
        diff)        _git_diff ;;
+       difftool)    _git_difftool ;;
        fetch)       _git_fetch ;;
        format-patch) _git_format_patch ;;
        fsck)        _git_fsck ;;