From: Junio C Hamano Date: Fri, 10 Feb 2017 20:52:25 +0000 (-0800) Subject: Merge branch 'js/difftool-builtin' X-Git-Tag: v2.12.0-rc1~6 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/163d24dc4d914191d1981ed0d9fa2a5d91b7d412?ds=inline;hp=-c Merge branch 'js/difftool-builtin' A few hot-fixes to C-rewrite of "git difftool". * js/difftool-builtin: t7800: simplify basic usage test difftool: fix bug when printing usage --- 163d24dc4d914191d1981ed0d9fa2a5d91b7d412 diff --combined t/t7800-difftool.sh index aa0ef02597,3d728e296d..97bae54d83 --- a/t/t7800-difftool.sh +++ b/t/t7800-difftool.sh @@@ -23,6 -23,18 +23,18 @@@ prompt_given ( test "$prompt" = "Launch 'test-tool' [Y/n]? branch" } + test_expect_success 'basic usage requires no repo' ' + test_expect_code 129 git difftool -h >output && + grep ^usage: output && + # create a ceiling directory to prevent Git from finding a repo + mkdir -p not/repo && + test_when_finished rm -r not && + test_expect_code 129 \ + env GIT_CEILING_DIRECTORIES="$(pwd)/not" \ + git -C not/repo difftool -h >output && + grep ^usage: output + ' + # Create a file on master and change it on branch test_expect_success 'setup' ' echo master >file && @@@ -374,7 -386,6 +386,7 @@@ test_expect_success 'setup change in su echo master >sub/sub && git add sub/sub && git commit -m "added sub/sub" && + git tag v1 && echo test >>file && echo test >>sub/sub && git add file sub/sub && @@@ -410,49 -421,12 +422,49 @@@ run_dir_diff_test 'difftool --dir-diff grep file output ' -run_dir_diff_test 'difftool --dir-diff from subdirectory' ' +run_dir_diff_test 'difftool --dir-diff branch from subdirectory' ' ( cd sub && git difftool --dir-diff $symlinks --extcmd ls branch >output && - grep sub output && - grep file output + # "sub" must only exist in "right" + # "file" and "file2" must be listed in both "left" and "right" + test "1" = $(grep sub output | wc -l) && + test "2" = $(grep file"$" output | wc -l) && + test "2" = $(grep file2 output | wc -l) + ) +' + +run_dir_diff_test 'difftool --dir-diff v1 from subdirectory' ' + ( + cd sub && + git difftool --dir-diff $symlinks --extcmd ls v1 >output && + # "sub" and "file" exist in both v1 and HEAD. + # "file2" is unchanged. + test "2" = $(grep sub output | wc -l) && + test "2" = $(grep file output | wc -l) && + test "0" = $(grep file2 output | wc -l) + ) +' + +run_dir_diff_test 'difftool --dir-diff branch from subdirectory w/ pathspec' ' + ( + cd sub && + git difftool --dir-diff $symlinks --extcmd ls branch -- .>output && + # "sub" only exists in "right" + # "file" and "file2" must not be listed + test "1" = $(grep sub output | wc -l) && + test "0" = $(grep file output | wc -l) + ) +' + +run_dir_diff_test 'difftool --dir-diff v1 from subdirectory w/ pathspec' ' + ( + cd sub && + git difftool --dir-diff $symlinks --extcmd ls v1 -- .>output && + # "sub" exists in v1 and HEAD + # "file" is filtered out by the pathspec + test "2" = $(grep sub output | wc -l) && + test "0" = $(grep file output | wc -l) ) '