Message ID | 678f9b11fc7df7d3ee2050388574bcaea86af331.1556009181.git.liu.denton@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | difftool and mergetool improvements | expand |
Denton Liu <liu.denton@gmail.com> writes: > In 063f2bdbf7 (mergetool: accept -g/--[no-]gui as arguments, > 2018-10-24), mergetool was taught the --gui option but no tests were > added to ensure that it was working properly. Add a test to ensure that > it works. > > Signed-off-by: Denton Liu <liu.denton@gmail.com> > --- > t/t7610-mergetool.sh | 22 ++++++++++++++++++++++ > 1 file changed, 22 insertions(+) > > diff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh > index a9fb971615..5f37d7a1ff 100755 > --- a/t/t7610-mergetool.sh > +++ b/t/t7610-mergetool.sh > @@ -145,6 +145,28 @@ test_expect_success 'custom mergetool' ' > git commit -m "branch1 resolved with mergetool" > ' > > +test_expect_success 'gui mergetool' ' > + test_config merge.guitool myguitool && > + test_config mergetool.myguitool.cmd "(printf \"gui \" && cat \"\$REMOTE\") >\"\$MERGED\"" && > + test_config mergetool.myguitool.trustExitCode true && > + test_when_finished "git reset --hard" && > + git checkout -b test$test_count branch1 && > + git submodule update -N && > + test_must_fail git merge master >/dev/null 2>&1 && > + ( yes "" | git mergetool --gui both >/dev/null 2>&1 ) && > + ( yes "" | git mergetool -g file1 file1 ) && > + ( yes "" | git mergetool --gui file2 "spaced name" >/dev/null 2>&1 ) && > + ( yes "" | git mergetool --gui subdir/file3 >/dev/null 2>&1 ) && > + ( yes "d" | git mergetool --gui file11 >/dev/null 2>&1 ) && > + ( yes "d" | git mergetool --gui file12 >/dev/null 2>&1 ) && > + ( yes "l" | git mergetool --gui submod >/dev/null 2>&1 ) && We usually discourage suppressing the output from git commands being tested like the above via redirection. This new testlet seems to mimick the way some of the existing ones are written, but it seems that not all invocations of mergetool in this file discard the output. Is there a particular reason why there are two styles? If not, I think we would want to standardize on *not* discarding. Thanks.
diff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh index a9fb971615..5f37d7a1ff 100755 --- a/t/t7610-mergetool.sh +++ b/t/t7610-mergetool.sh @@ -145,6 +145,28 @@ test_expect_success 'custom mergetool' ' git commit -m "branch1 resolved with mergetool" ' +test_expect_success 'gui mergetool' ' + test_config merge.guitool myguitool && + test_config mergetool.myguitool.cmd "(printf \"gui \" && cat \"\$REMOTE\") >\"\$MERGED\"" && + test_config mergetool.myguitool.trustExitCode true && + test_when_finished "git reset --hard" && + git checkout -b test$test_count branch1 && + git submodule update -N && + test_must_fail git merge master >/dev/null 2>&1 && + ( yes "" | git mergetool --gui both >/dev/null 2>&1 ) && + ( yes "" | git mergetool -g file1 file1 ) && + ( yes "" | git mergetool --gui file2 "spaced name" >/dev/null 2>&1 ) && + ( yes "" | git mergetool --gui subdir/file3 >/dev/null 2>&1 ) && + ( yes "d" | git mergetool --gui file11 >/dev/null 2>&1 ) && + ( yes "d" | git mergetool --gui file12 >/dev/null 2>&1 ) && + ( yes "l" | git mergetool --gui submod >/dev/null 2>&1 ) && + test "$(cat file1)" = "gui master updated" && + test "$(cat file2)" = "gui master new" && + test "$(cat subdir/file3)" = "gui master new sub" && + test "$(cat submod/bar)" = "branch1 submodule" && + git commit -m "branch1 resolved with mergetool" +' + test_expect_success 'mergetool crlf' ' test_when_finished "git reset --hard" && # This test_config line must go after the above reset line so that
In 063f2bdbf7 (mergetool: accept -g/--[no-]gui as arguments, 2018-10-24), mergetool was taught the --gui option but no tests were added to ensure that it was working properly. Add a test to ensure that it works. Signed-off-by: Denton Liu <liu.denton@gmail.com> --- t/t7610-mergetool.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)