Merge branch 'th/difftool-diffall'
authorJunio C Hamano <gitster@pobox.com>
Mon, 7 May 2012 20:28:44 +0000 (13:28 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 7 May 2012 20:28:44 +0000 (13:28 -0700)
Rolls the two-directory-diff logic from diffall script (in contrib/) into
"git difftool" framework.

By Tim Henigan
* th/difftool-diffall:
difftool: print list of valid tools with '--tool-help'
difftool: teach difftool to handle directory diffs
difftool: eliminate setup_environment function
difftool: stop appending '.exe' to git
difftool: remove explicit change of PATH
difftool: exit(0) when usage is printed
difftool: add '--no-gui' option
difftool: parse options using Getopt::Long

1  2 
t/t7800-difftool.sh
diff --combined t/t7800-difftool.sh
index 2763d795f0ae94c56a77fb630210df0928df468e,bbe71e5f73a0b1a95c8afc4365a8b7c93bfcf40d..9c3e997b9d6be69467a78f9ff8b1ff746be8e9b6
@@@ -83,17 -83,6 +83,17 @@@ test_expect_success PERL 'difftool igno
        test "$diff" = ""
  '
  
 +test_expect_success PERL 'difftool forwards arguments to diff' '
 +      >for-diff &&
 +      git add for-diff &&
 +      echo changes>for-diff &&
 +      git add for-diff &&
 +      diff=$(git difftool --cached --no-prompt -- for-diff) &&
 +      test "$diff" = "" &&
 +      git reset -- for-diff &&
 +      rm for-diff
 +'
 +
  test_expect_success PERL 'difftool honors --gui' '
        git config merge.tool bogus-tool &&
        git config diff.tool bogus-tool &&
        restore_test_defaults
  '
  
+ test_expect_success PERL 'difftool --gui last setting wins' '
+       git config diff.guitool bogus-tool &&
+       git difftool --no-prompt --gui --no-gui &&
+       git config merge.tool bogus-tool &&
+       git config diff.tool bogus-tool &&
+       git config diff.guitool test-tool &&
+       diff=$(git difftool --no-prompt --no-gui --gui branch) &&
+       test "$diff" = "branch" &&
+       restore_test_defaults
+ '
  test_expect_success PERL 'difftool --gui works without configured diff.guitool' '
        git config diff.tool test-tool &&
  
@@@ -317,4 -319,48 +330,48 @@@ test_expect_success PERL 'say no to th
        echo "$diff" | stdin_doesnot_contain br2
  '
  
+ test_expect_success PERL 'difftool --tool-help' '
+       tool_help=$(git difftool --tool-help) &&
+       echo "$tool_help" | stdin_contains tool
+ '
+ test_expect_success PERL 'setup change in subdirectory' '
+       git checkout master &&
+       mkdir sub &&
+       echo master >sub/sub &&
+       git add sub/sub &&
+       git commit -m "added sub/sub" &&
+       echo test >>file &&
+       echo test >>sub/sub &&
+       git add . &&
+       git commit -m "modified both"
+ '
+ test_expect_success PERL 'difftool -d' '
+       diff=$(git difftool -d --extcmd ls branch) &&
+       echo "$diff" | stdin_contains sub &&
+       echo "$diff" | stdin_contains file
+ '
+ test_expect_success PERL 'difftool --dir-diff' '
+       diff=$(git difftool --dir-diff --extcmd ls branch) &&
+       echo "$diff" | stdin_contains sub &&
+       echo "$diff" | stdin_contains file
+ '
+ test_expect_success PERL 'difftool --dir-diff ignores --prompt' '
+       diff=$(git difftool --dir-diff --prompt --extcmd ls branch) &&
+       echo "$diff" | stdin_contains sub &&
+       echo "$diff" | stdin_contains file
+ '
+ test_expect_success PERL 'difftool --dir-diff from subdirectory' '
+       (
+               cd sub &&
+               diff=$(git difftool --dir-diff --extcmd ls branch) &&
+               echo "$diff" | stdin_contains sub &&
+               echo "$diff" | stdin_contains file
+       )
+ '
  test_done