All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Slavica Djukic <slavicadj.ip2018@gmail.com>
Cc: Johannes.Schindelin@gmx.de, git@vger.kernel.org, slawica92@hotmail.com
Subject: Re: [PATCH v2 1/2] [Outreachy] t3903-stash: test without configured user.name and user.email
Date: Fri, 16 Nov 2018 14:55:08 +0900	[thread overview]
Message-ID: <xmqqsh01k1mr.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20181114222524.2624-1-slawica92@hotmail.com> (Slavica Djukic's message of "Wed, 14 Nov 2018 23:25:24 +0100")

Slavica Djukic <slavicadj.ip2018@gmail.com> writes:

> +test_expect_failure 'stash works when user.name and user.email are not set' '
> +	git reset &&
> +	git var GIT_COMMITTER_IDENT >expected &&

All the other existing test pieces in this file calls the expected
result "expect"; is there a reason why this patch needs to be
different (e.g. 'expect' file left by the earlier step needs to be
kept unmodified for later use, or something like that)?  If not,
please avoid making a difference in irrelevant details, as that
would waste time of readers by forcing them to guess if there is
such a reason that readers cannot immediately see.

Anyway, we grab the committer ident we use by default during the
test with this command.  OK.

> +	>1 &&
> +	git add 1 &&
> +	git stash &&

And we make sure we can create stash.

> +	git var GIT_COMMITTER_IDENT >actual &&
> +	test_cmp expected actual &&

I am not sure what you are testing with this step.  There is nothing
that changed environment variables or configuration since we ran
"git var" above.  Why does this test suspect that somebody in the
future may break the expectation that after running 'git add' and/or
'git stash', our committer identity may have been changed, and how
would such a breakage happen?

> +	>2 &&
> +	git add 2 &&
> +	test_config user.useconfigonly true &&
> +	test_config stash.usebuiltin true &&

Now we start using use-config-only, so unsetting environment
variables will cause trouble when Git insists on having an
explicitly configured identities.  Makes sense.

> +	(
> +		sane_unset GIT_AUTHOR_NAME &&
> +		sane_unset GIT_AUTHOR_EMAIL &&
> +		sane_unset GIT_COMMITTER_NAME &&
> +		sane_unset GIT_COMMITTER_EMAIL &&
> +		test_unconfig user.email &&
> +		test_unconfig user.name &&

And then we try the same test, but without environment or config.
Since we are unsetting the environment, in order to be nice for
future test writers, we do this in a subshell, so that we do not
have to restore the original values of environment variables.

Don't we need to be nice the same way for configuration variables,
though?  We _know_ that nobody sets user.{email,name} config up to
this point in the test sequence, so that is why we do not do a "save
before test and then restore to the original" dance on them.  Even
though we are relying on the fact that these two variables are left
unset in the configuration file, we unconfig them here anyway, and I
do think it is a good idea for documentation purposes (i.e. we are
not documenting what we assume the config before running this test
would be; we are documenting what state we want these two variables
are in when running this "git stash"---that is, they are both unset).

So these later part of this test piece makes sense.  I still do not
know what you wanted to check in the earlier part of the test,
though.

> +		git stash
> +	)
> +'
> +
>  test_done

  parent reply	other threads:[~2018-11-16  5:55 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-23 16:29 [PATCH 1/3] [Outreachy] t3903-stash: test without configured user name Slavica
2018-10-23 18:52 ` Christian Couder
2018-10-24 13:56   ` Slavica
2018-10-25  4:44     ` Junio C Hamano
2018-10-23 19:19 ` Eric Sunshine
2018-10-24  2:48 ` Junio C Hamano
2018-10-24  7:39   ` Johannes Schindelin
2018-10-24  9:58     ` Junio C Hamano
2018-10-24 15:18       ` Johannes Schindelin
2018-10-25  4:17         ` Junio C Hamano
2018-10-24 20:01 ` [PATCH v2 " Slavica Djukic
2018-10-24 20:05   ` Slavica Djukic
2018-10-24 20:25     ` Eric Sunshine
2018-10-25  4:48       ` Junio C Hamano
2018-10-25 19:13   ` [PATCH v3 " Slavica Djukic
2018-10-25 19:20     ` Slavica Djukic
2018-10-26  1:13       ` Junio C Hamano
2018-10-30 13:04         ` Slavica Djukic
2018-11-01 11:55       ` [PATCH 0/3] [Outreachy] make stash work if user.name and user.email are not configured Slavica Djukic
2018-11-01 11:58         ` [PATCH 1/3][Outreachy] t3903-stash: test without configured user.name and user.email Slavica Djukic
2018-11-01 14:53           ` Christian Couder
2018-11-02  4:59           ` [PATCH 2+3/3] stash: tolerate missing user identity Junio C Hamano
2018-11-01 12:00         ` [PATCH 2/3] [Outreachy] ident: introduce set_fallback_ident() function Slavica Djukic
2018-11-02  3:01           ` Junio C Hamano
2018-11-02  4:41             ` Junio C Hamano
2018-11-02  5:22               ` Junio C Hamano
2018-11-01 12:02         ` [PATCH 3/3] [Outreachy] stash: use " Slavica Djukic
2018-11-14 22:12         ` [PATCH v2 0/2] [Outreachy] make stash work if user.name and user.email are not configured Slavica Djukic
2018-11-14 22:25           ` [PATCH v2 1/2] [Outreachy] t3903-stash: test without configured user.name and user.email Slavica Djukic
2018-11-15 12:37             ` Johannes Schindelin
2018-11-16  5:55             ` Junio C Hamano [this message]
2018-11-16  6:26               ` Junio C Hamano
2018-11-16  6:32               ` Junio C Hamano
2018-11-16  8:28               ` Slavica Djukic
2018-11-16 10:12                 ` Junio C Hamano
2018-11-17 18:47                   ` Slavica Djukic
2018-11-18  6:28                     ` Junio C Hamano
2018-11-14 22:28           ` [PATCH v2 2/2] [Outreachy] stash: tolerate missing user identity Slavica Djukic
2018-11-16  5:35             ` Junio C Hamano
2018-11-18 13:29           ` [PATCH 0/1 v3] make stash work if user.name and user.email are not configured Slavica Djukic
2018-11-18 13:44             ` [PATCH 1/1 v3] stash: tolerate missing user identity Slavica Djukic

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

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

  git send-email \
    --in-reply-to=xmqqsh01k1mr.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=slavicadj.ip2018@gmail.com \
    --cc=slawica92@hotmail.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.