diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-10-21 16:04:32 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-10-21 16:04:32 -0700 |
commit | 1ad4b17b069a7b692ab801bda37c5ab35ef0208e (patch) | |
tree | ef5b1882b491f189681538b5f473c34e7cbff3cf /t | |
parent | Merge branch 'jc/unseekable-bundle' (diff) | |
parent | t7800: avoid arithmetic expansion notation (diff) | |
download | tgif-1ad4b17b069a7b692ab801bda37c5ab35ef0208e.tar.xz |
Merge branch 'sc/difftool-skip'
* sc/difftool-skip:
t7800: avoid arithmetic expansion notation
git-difftool: allow skipping file by typing 'n' at prompt
Diffstat (limited to 't')
-rwxr-xr-x | t/t7800-difftool.sh | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh index 395adfc8a9..4fb4c9384a 100755 --- a/t/t7800-difftool.sh +++ b/t/t7800-difftool.sh @@ -38,7 +38,17 @@ restore_test_defaults() prompt_given() { prompt="$1" - test "$prompt" = "Hit return to launch 'test-tool': branch" + test "$prompt" = "Launch 'test-tool' [Y/n]: branch" +} + +stdin_contains() +{ + grep >/dev/null "$1" +} + +stdin_doesnot_contain() +{ + ! stdin_contains "$1" } # Create a file on master and change it on branch @@ -265,4 +275,35 @@ test_expect_success PERL 'difftool --extcmd cat arg2' ' test "$diff" = branch ' +# Create a second file on master and a different version on branch +test_expect_success PERL 'setup with 2 files different' ' + echo m2 >file2 && + git add file2 && + git commit -m "added file2" && + + git checkout branch && + echo br2 >file2 && + git add file2 && + git commit -a -m "branch changed file2" && + git checkout master +' + +test_expect_success PERL 'say no to the first file' ' + diff=$( (echo n; echo) | git difftool -x cat branch ) && + + echo "$diff" | stdin_contains m2 && + echo "$diff" | stdin_contains br2 && + echo "$diff" | stdin_doesnot_contain master && + echo "$diff" | stdin_doesnot_contain branch +' + +test_expect_success PERL 'say no to the second file' ' + diff=$( (echo; echo n) | git difftool -x cat branch ) && + + echo "$diff" | stdin_contains master && + echo "$diff" | stdin_contains branch && + echo "$diff" | stdin_doesnot_contain m2 && + echo "$diff" | stdin_doesnot_contain br2 +' + test_done |