git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Denton Liu <liu.denton@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, davvid@gmail.com, Johannes.Schindelin@gmx.de
Subject: Re: [PATCH v2 2/5] Use -y where possible in test t7610-mergetool
Date: Fri, 3 Mar 2017 13:21:50 -0800	[thread overview]
Message-ID: <20170303212150.GA13790@arch-attack.localdomain> (raw)
In-Reply-To: <xmqqd1dy880d.fsf@gitster.mtv.corp.google.com>

On Fri, Mar 03, 2017 at 11:39:30AM -0800, Junio C Hamano wrote:
> Denton Liu <liu.denton@gmail.com> writes:
> 
> > In these tests, there are many situations where
> > 'echo "" | git mergetool' is used. This replaces all of those
> > occurrences with 'git mergetool -y' for simplicity and readability.
> 
> "-y where _possible_" is not necessarily a good thing to do in
> tests.  We do want to make sure that both "yes" from the input and
> "-y" from the command line work.  Changes to "-y" done only for the
> tests that are not about accepting the interactive input from the
> end-user is a very good idea, but "replaces all of those" makes me
> worried.
The 'custom mergetool' test case seems like a good place to introduce an
interactive test. Would the following patch to my patch work?

diff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh
index b6a419258..71624583c 100755
--- a/t/t7610-mergetool.sh
+++ b/t/t7610-mergetool.sh
@@ -135,8 +135,8 @@ test_expect_success 'custom mergetool' '
 	test_expect_code 1 git merge master >/dev/null 2>&1 &&
 	git mergetool -y both >/dev/null 2>&1 &&
 	git mergetool -y file1 file1 &&
-	git mergetool -y file2 "spaced name" >/dev/null 2>&1 &&
-	git mergetool -y subdir/file3 >/dev/null 2>&1 &&
+	( yes "" | git mergetool file2 "spaced name" >/dev/null 2>&1 ) &&
+	( yes "" | git mergetool subdir/file3 >/dev/null 2>&1 ) &&
 	( yes "d" | git mergetool file11 >/dev/null 2>&1 ) &&
 	( yes "d" | git mergetool file12 >/dev/null 2>&1 ) &&
 	( yes "l" | git mergetool submod >/dev/null 2>&1 ) &&

> > -	( yes "" | git mergetool file1 >/dev/null 2>&1 ) &&
> > -	( yes "" | git mergetool file2 >/dev/null 2>&1 ) &&
> > -	( yes "" | git mergetool "spaced name" >/dev/null 2>&1 ) &&
> > -	( yes "" | git mergetool both >/dev/null 2>&1 ) &&
> > -	( yes "" | git mergetool subdir/file3 >/dev/null 2>&1 ) &&
> > +	git mergetool file1 >/dev/null 2>&1 &&
> > +	git mergetool file2 >/dev/null 2>&1 &&
> > +	git mergetool "spaced name" >/dev/null 2>&1 &&
> > +	git mergetool both >/dev/null 2>&1 &&
> > +	git mergetool subdir/file3 >/dev/null 2>&1 &&
> 
> The reason for the lack of "-y" in the rewrite, in contrast to what
> was done in the previous hunk we saw, is not quite obvious.
> 
Sorry, it was my mistake. I had forgotten to replace the '-y'. I have
corrected this for a future revision.

      reply	other threads:[~2017-03-03 21:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-03 13:40 [PATCH v2 2/5] Use -y where possible in test t7610-mergetool Denton Liu
2017-03-03 19:39 ` Junio C Hamano
2017-03-03 21:21   ` Denton Liu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170303212150.GA13790@arch-attack.localdomain \
    --to=liu.denton@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).