git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Aloni <alonid@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>,
	Eric Sunshine <sunshine@sunshineco.com>
Subject: Re: [PATCH v4 2/3] Add user.useConfigOnly boolean for when ident shouldn't be guessed
Date: Fri, 5 Feb 2016 08:47:54 +0200	[thread overview]
Message-ID: <20160205064754.GB15392@gmail.com> (raw)
In-Reply-To: <xmqq8u30gn1m.fsf@gitster.mtv.corp.google.com>

On Thu, Feb 04, 2016 at 01:53:25PM -0800, Junio C Hamano wrote:
>[..]
> "by adding a new configuration variable" is a bit weak.  Help the
> reader by mentioning what it is called and what it does in the same
> sentence.
> 
> Perhaps like this?
> 
> -- >8 --
>[..]
>

Looks good, I'll just take that :)

>     ident: add user.useConfigOnly boolean for when ident shouldn't be guessed
>[..]
> >  		}
> > +		if (strict && ident_use_config_only && !(ident_config_given & IDENT_MAIL_GIVEN))
> > +			die("user.useConfigOnly set but no mail given");
> >  	}
> 
> By folding the line just like you did for "name" above, you do not
> have to worry about an overlong line here.

Consistency is important. Will fix here too, though it got fixed later
in the cleanup.

>[..]
> > +        git add foo &&
> > +        EDITOR=: VISUAL=: git commit -m foo &&
> 
> What is the point of these one-shot assignments to the environment
> variables?
> 
> "git commit -m <msg>" does not invoke the editor unless given "-e",
> and EDITOR=: is done early in test-lib.sh already, so I am puzzled.
> 
> Besides, if you are worried about some stray environment variable,
> overriding EDITOR and VISUAL would not guard you against a stray
> GIT_EDITOR, which takes the precedence, I think.

Being new to this testing framework, I tried learning the trade from
other tests. Maybe I goofed, or the other tests need cleaning?

> 
> > +	# Setup a likely user.useConfigOnly use case
> > +	unset GIT_AUTHOR_NAME &&
> > +	unset GIT_AUTHOR_EMAIL &&
> 
> Doesn't unset fail when the variable is not set (we have sane_unset
> helper for that)?

Sure.

>[..] 
> > +test_expect_success 'fails committing if clone email is not set, but EMAIL set' '
> > +        prepare && about_to_commit &&
> > +
> > +	EMAIL=test@fail.com EDITOR=: VISUAL=: test_must_fail git commit -m msg
> 
> This is a good place to use the "test_must_fail env" pattern, i.e.
> 
> 	test_must_fail env EMAIL=test@fail.com git commit -m msg
> 
> I would think.

Yes, and the fixed test still passes. Will resubmit the patches.

-- 
Dan Aloni

  reply	other threads:[~2016-02-05  6:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-04  9:12 [PATCH v4] Add user.useConfigOnly boolean for when ident shouldn't be guessed Dan Aloni
2016-02-04  9:12 ` [PATCH v4 1/3] fmt_ident: refactor strictness checks Dan Aloni
2016-02-04  9:12 ` [PATCH v4 2/3] Add user.useConfigOnly boolean for when ident shouldn't be guessed Dan Aloni
2016-02-04 21:53   ` Junio C Hamano
2016-02-05  6:47     ` Dan Aloni [this message]
2016-02-04  9:12 ` [PATCH v4 3/3] ident.c: cleanup wrt ident's source Dan Aloni
2016-02-04 21:33   ` Junio C Hamano
2016-02-04 22:42   ` Junio C Hamano
2016-02-05  6:40     ` Dan Aloni

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=20160205064754.GB15392@gmail.com \
    --to=alonid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=sunshine@sunshineco.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 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 NNTP newsgroup(s).