git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / Atom feed
From: Jeff King <peff@peff.net>
To: Jonathan Tan <jonathantanmy@google.com>
Cc: git@vger.kernel.org, steadmon@google.com
Subject: Re: [PATCH 1/8] tests: define GIT_TEST_PROTOCOL_VERSION
Date: Mon, 11 Feb 2019 15:20:00 -0500
Message-ID: <20190211201959.GA9072@sigill.intra.peff.net> (raw)
In-Reply-To: <6e0c6aa9a71d4192591ed406735684cd15a0e3b9.1549411880.git.jonathantanmy@google.com>

On Tue, Feb 05, 2019 at 04:21:15PM -0800, Jonathan Tan wrote:

> Define a GIT_TEST_PROTOCOL_VERSION environment variable meant to be used
> from tests. When set, this ensures protocol.version is at least the
> given value, allowing the entire test suite to be run as if this
> configuration is in place for all repositories.
> 
> As of this patch, all tests pass whether GIT_TEST_PROTOCOL_VERSION is
> unset, set to 0, or set to 1. Some tests fail when
> GIT_TEST_PROTOCOL_VERSION is set to 2, but this will be dealt with in
> subsequent patches.

Makes sense. The "at least" part made me scratch my head at first, but
your explanation in response to Ævar made sense.

Two minor nits:

> diff --git a/protocol.c b/protocol.c
> index 5664bd7a05..c7a735bfa2 100644
> --- a/protocol.c
> +++ b/protocol.c
> @@ -42,6 +42,10 @@ static const char *format_protocol_version(enum protocol_version version)
>  enum protocol_version get_protocol_version_config(void)
>  {
>  	const char *value;
> +	enum protocol_version retval = protocol_v0;
> +	const char *git_test_k = "GIT_TEST_PROTOCOL_VERSION";
> +	const char *git_test_v = getenv(git_test_k);

We've discussed recently how the return value from getenv() isn't
stable. It looks like we could assign it much closer to the point-of-use
here (which still isn't 100% foolproof, but I think is something we
could encourage as a general pattern, and mostly works due to our
ring-buffer technique).

I.e., right before this conditional:

> +
> +	if (git_test_v && strlen(git_test_v)) {

It's more idiomatic in our code base to check for a non-empty string as:

  if (git_test_v && *git_test_v)

though obviously that's pretty minor.

-Peff

  parent reply index

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-06  0:21 [PATCH 0/8] Resend of GIT_TEST_PROTOCOL_VERSION patches Jonathan Tan
2019-02-06  0:21 ` [PATCH 1/8] tests: define GIT_TEST_PROTOCOL_VERSION Jonathan Tan
2019-02-06 21:58   ` Ævar Arnfjörð Bjarmason
2019-02-07  0:01     ` Jonathan Tan
2019-02-11 20:20   ` Jeff King [this message]
2019-02-06  0:21 ` [PATCH 2/8] tests: always test fetch of unreachable with v0 Jonathan Tan
2019-02-11 20:30   ` Jeff King
2019-02-14 19:58     ` Jonathan Tan
2019-02-21 13:49       ` Jeff King
2019-02-22 20:47         ` Junio C Hamano
2019-02-23 13:25           ` Jeff King
2019-02-06  0:21 ` [PATCH 3/8] t5503: fix overspecification of trace expectation Jonathan Tan
2019-02-06  0:21 ` [PATCH 4/8] t5512: compensate for v0 only sending HEAD symrefs Jonathan Tan
2019-02-06  0:21 ` [PATCH 5/8] t5700: only run with protocol version 1 Jonathan Tan
2019-02-06  0:21 ` [PATCH 6/8] tests: fix protocol version for overspecifications Jonathan Tan
2019-02-06  0:21 ` [PATCH 7/8] t5552: compensate for v2 filtering ref adv Jonathan Tan
2019-02-06  0:21 ` [PATCH 8/8] remote-curl: in v2, fill credentials if needed Jonathan Tan
2019-02-06 21:29   ` Jeff King
2019-02-11 19:20     ` Jonathan Tan
2019-02-11 20:38       ` Jeff King
2019-02-06 21:34 ` [PATCH 0/8] Resend of GIT_TEST_PROTOCOL_VERSION patches Jeff King
2019-02-06 21:52   ` Ævar Arnfjörð Bjarmason
2019-02-06 22:10     ` Jeff King
2019-02-06 22:20       ` Ævar Arnfjörð Bjarmason
2019-02-06 23:08         ` Jeff King
2019-02-07 10:49           ` Ævar Arnfjörð Bjarmason
2019-02-25 21:54 [PATCH 0/8] GIT_TEST_PROTOCOL_VERSION, this time on master Jonathan Tan
2019-02-25 21:54 ` [PATCH 1/8] tests: define GIT_TEST_PROTOCOL_VERSION Jonathan Tan

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=20190211201959.GA9072@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=jonathantanmy@google.com \
    --cc=steadmon@google.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

git@vger.kernel.org list mirror (unofficial, one of many)

Archives are clonable:
	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git