git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [WIP 0/8] Trying to revive GIT_TEST_PROTOCOL_VERSION
@ 2019-01-16 22:42 Jonathan Tan
  2019-01-16 22:42 ` [WIP 1/8] tests: define GIT_TEST_PROTOCOL_VERSION Jonathan Tan
                   ` (8 more replies)
  0 siblings, 9 replies; 12+ messages in thread
From: Jonathan Tan @ 2019-01-16 22:42 UTC (permalink / raw)
  To: git; +Cc: Jonathan Tan, avarab

Ævar, are you planning to revive GIT_TEST_PROTOCOL_VERSION? I have
updated the patchset in light of some new branches that have appeared.

This is on master merged with:
 - jk/proto-v2-hidden-refs-fix
 - tg/t5570-drop-racy-test
 - js/protocol-advertise-multi
 - jt/upload-pack-deepen-relative-proto-v2
 - jt/fetch-pack-v2

One notable change I made is that I made this envvar determine the
minimum version. So, if GIT_TEST_PROTOCOL_VERSION=1 and the test
explicitly states v2, v2 is used (but if GIT_TEST_PROTOCOL_VERISON=2,
all use v2). I think this reduces the number of false negatives, since
there are quite a few tests that use v2 specific features, and that are
already marked as v2.

I included one genuine bug fix (the last patch) and the rest are either
overspecifications (which I didn't investigate too deeply) or false
negatives. There are still some errors when run with
GIT_TEST_PROTOCOL_VERSION=2 which I don't think are false negatives -
I'll continue to look into them.

Jonathan Tan (8):
  tests: define GIT_TEST_PROTOCOL_VERSION
  tests: always test fetch of unreachable with v0
  t5503: fix overspecification of trace expectation
  t5512: compensate for v0 only sending HEAD symrefs
  t5700: only run with protocol version 1
  tests: fix protocol version for overspecifications
  t5552: compensate for v2 filtering ref adv.
  remote-curl: in v2, fill credentials if needed

 protocol.c                           | 17 ++++++++--
 remote-curl.c                        |  9 +++++-
 t/README                             |  3 ++
 t/t5400-send-pack.sh                 |  2 +-
 t/t5500-fetch-pack.sh                |  4 ++-
 t/t5503-tagfollow.sh                 |  2 +-
 t/t5512-ls-remote.sh                 | 18 ++++++++---
 t/t5515-fetch-merge-logic.sh         |  4 +++
 t/t5516-fetch-push.sh                | 22 ++++++++++---
 t/t5539-fetch-http-shallow.sh        |  5 ++-
 t/t5541-http-push-smart.sh           | 14 +++++++--
 t/t5551-http-fetch-smart.sh          | 47 +++++++++++++++++++++-------
 t/t5552-skipping-fetch-negotiator.sh |  5 ++-
 t/t5700-protocol-v1.sh               |  3 ++
 t/t7406-submodule-update.sh          |  5 ++-
 15 files changed, 128 insertions(+), 32 deletions(-)

-- 
2.19.0.271.gfe8321ec05.dirty


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [WIP 1/8] tests: define GIT_TEST_PROTOCOL_VERSION
  2019-01-16 22:42 [WIP 0/8] Trying to revive GIT_TEST_PROTOCOL_VERSION Jonathan Tan
@ 2019-01-16 22:42 ` Jonathan Tan
  2019-01-16 22:42 ` [WIP 2/8] tests: always test fetch of unreachable with v0 Jonathan Tan
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Jonathan Tan @ 2019-01-16 22:42 UTC (permalink / raw)
  To: git; +Cc: Jonathan Tan, avarab

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.

This is based on work by Ævar Arnfjörð Bjarmason.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
---
 protocol.c                  | 17 +++++++++++++++--
 t/README                    |  3 +++
 t/t5400-send-pack.sh        |  2 +-
 t/t5551-http-fetch-smart.sh |  3 ++-
 4 files changed, 21 insertions(+), 4 deletions(-)

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);
+
 	if (!git_config_get_string_const("protocol.version", &value)) {
 		enum protocol_version version = parse_protocol_version(value);
 
@@ -49,10 +53,19 @@ enum protocol_version get_protocol_version_config(void)
 			die("unknown value for config 'protocol.version': %s",
 			    value);
 
-		return version;
+		retval = version;
+	}
+
+	if (git_test_v && strlen(git_test_v)) {
+		enum protocol_version env = parse_protocol_version(git_test_v);
+
+		if (env == protocol_unknown_version)
+			die("unknown value for %s: %s", git_test_k, git_test_v);
+		if (retval < env)
+			retval = env;
 	}
 
-	return protocol_v0;
+	return retval;
 }
 
 void register_allowed_protocol_version(enum protocol_version version)
diff --git a/t/README b/t/README
index 28711cc508..fd7f29cbe1 100644
--- a/t/README
+++ b/t/README
@@ -311,6 +311,9 @@ marked strings" in po/README for details.
 GIT_TEST_SPLIT_INDEX=<boolean> forces split-index mode on the whole
 test suite. Accept any boolean values that are accepted by git-config.
 
+GIT_TEST_PROTOCOL_VERSION=<n>, when set, overrides the
+'protocol.version' setting to n if it is less than n.
+
 GIT_TEST_FULL_IN_PACK_ARRAY=<boolean> exercises the uncommon
 pack-objects code path where there are more than 1024 packs even if
 the actual number of packs in repository is below this limit. Accept
diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh
index f1932ea431..571d620aed 100755
--- a/t/t5400-send-pack.sh
+++ b/t/t5400-send-pack.sh
@@ -288,7 +288,7 @@ test_expect_success 'receive-pack de-dupes .have lines' '
 	$shared .have
 	EOF
 
-	GIT_TRACE_PACKET=$(pwd)/trace \
+	GIT_TRACE_PACKET=$(pwd)/trace GIT_TEST_PROTOCOL_VERSION= \
 	    git push \
 		--receive-pack="unset GIT_TRACE_PACKET; git-receive-pack" \
 		fork HEAD:foo &&
diff --git a/t/t5551-http-fetch-smart.sh b/t/t5551-http-fetch-smart.sh
index a60dd907bd..8f620e0a35 100755
--- a/t/t5551-http-fetch-smart.sh
+++ b/t/t5551-http-fetch-smart.sh
@@ -44,7 +44,8 @@ test_expect_success 'clone http repository' '
 	< Cache-Control: no-cache, max-age=0, must-revalidate
 	< Content-Type: application/x-git-upload-pack-result
 	EOF
-	GIT_TRACE_CURL=true git clone --quiet $HTTPD_URL/smart/repo.git clone 2>err &&
+	GIT_TRACE_CURL=true GIT_TEST_PROTOCOL_VERSION= \
+		git clone --quiet $HTTPD_URL/smart/repo.git clone 2>err &&
 	test_cmp file clone/file &&
 	tr '\''\015'\'' Q <err |
 	sed -e "
-- 
2.19.0.271.gfe8321ec05.dirty


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [WIP 2/8] tests: always test fetch of unreachable with v0
  2019-01-16 22:42 [WIP 0/8] Trying to revive GIT_TEST_PROTOCOL_VERSION Jonathan Tan
  2019-01-16 22:42 ` [WIP 1/8] tests: define GIT_TEST_PROTOCOL_VERSION Jonathan Tan
@ 2019-01-16 22:42 ` Jonathan Tan
  2019-01-16 22:42 ` [WIP 3/8] t5503: fix overspecification of trace expectation Jonathan Tan
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Jonathan Tan @ 2019-01-16 22:42 UTC (permalink / raw)
  To: git; +Cc: Jonathan Tan, avarab

Some tests check that fetching an unreachable object fails, but protocol
v2 allows such fetches. Unset GIT_TEST_PROTOCOL_VERSION so that these
tests are always run using protocol v0.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
---
 t/t5500-fetch-pack.sh       |  4 +++-
 t/t5516-fetch-push.sh       | 22 +++++++++++++++++-----
 t/t5551-http-fetch-smart.sh | 10 ++++++++--
 t/t7406-submodule-update.sh |  5 ++++-
 4 files changed, 32 insertions(+), 9 deletions(-)

diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index 49c540b1e1..0ef4d6f20c 100755
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
@@ -636,7 +636,9 @@ test_expect_success 'fetch-pack cannot fetch a raw sha1 that is not advertised a
 	test_commit -C server 6 &&
 
 	git init client &&
-	test_must_fail git -C client fetch-pack ../server \
+	# Some protocol versions (e.g. 2) support fetching
+	# unadvertised objects, so restrict this test to v0.
+	test_must_fail env GIT_TEST_PROTOCOL_VERSION= git -C client fetch-pack ../server \
 		$(git -C server rev-parse refs/heads/master^) 2>err &&
 	test_i18ngrep "Server does not allow request for unadvertised object" err
 '
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 37e8e80893..4bfbb79654 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -1147,8 +1147,12 @@ test_expect_success 'fetch exact SHA1' '
 		git prune &&
 		test_must_fail git cat-file -t $the_commit &&
 
+		# Some protocol versions (e.g. 2) support fetching
+		# unadvertised objects, so restrict this test to v0.
+
 		# fetching the hidden object should fail by default
-		test_must_fail git fetch -v ../testrepo $the_commit:refs/heads/copy 2>err &&
+		test_must_fail env GIT_TEST_PROTOCOL_VERSION= \
+			git fetch -v ../testrepo $the_commit:refs/heads/copy 2>err &&
 		test_i18ngrep "Server does not allow request for unadvertised object" err &&
 		test_must_fail git rev-parse --verify refs/heads/copy &&
 
@@ -1204,7 +1208,10 @@ do
 		mk_empty shallow &&
 		(
 			cd shallow &&
-			test_must_fail git fetch --depth=1 ../testrepo/.git $SHA1 &&
+			# Some protocol versions (e.g. 2) support fetching
+			# unadvertised objects, so restrict this test to v0.
+			test_must_fail env GIT_TEST_PROTOCOL_VERSION= \
+				git fetch --depth=1 ../testrepo/.git $SHA1 &&
 			git --git-dir=../testrepo/.git config uploadpack.allowreachablesha1inwant true &&
 			git fetch --depth=1 ../testrepo/.git $SHA1 &&
 			git cat-file commit $SHA1
@@ -1232,15 +1239,20 @@ do
 		mk_empty shallow &&
 		(
 			cd shallow &&
-			test_must_fail ok=sigpipe git fetch ../testrepo/.git $SHA1_3 &&
-			test_must_fail ok=sigpipe git fetch ../testrepo/.git $SHA1_1 &&
+			# Some protocol versions (e.g. 2) support fetching
+			# unadvertised objects, so restrict this test to v0.
+			test_must_fail ok=sigpipe env GIT_TEST_PROTOCOL_VERSION= \
+				git fetch ../testrepo/.git $SHA1_3 &&
+			test_must_fail ok=sigpipe env GIT_TEST_PROTOCOL_VERSION= \
+				git fetch ../testrepo/.git $SHA1_1 &&
 			git --git-dir=../testrepo/.git config uploadpack.allowreachablesha1inwant true &&
 			git fetch ../testrepo/.git $SHA1_1 &&
 			git cat-file commit $SHA1_1 &&
 			test_must_fail git cat-file commit $SHA1_2 &&
 			git fetch ../testrepo/.git $SHA1_2 &&
 			git cat-file commit $SHA1_2 &&
-			test_must_fail ok=sigpipe git fetch ../testrepo/.git $SHA1_3
+			test_must_fail ok=sigpipe env GIT_TEST_PROTOCOL_VERSION= \
+				git fetch ../testrepo/.git $SHA1_3
 		)
 	'
 done
diff --git a/t/t5551-http-fetch-smart.sh b/t/t5551-http-fetch-smart.sh
index 8f620e0a35..d2661eb338 100755
--- a/t/t5551-http-fetch-smart.sh
+++ b/t/t5551-http-fetch-smart.sh
@@ -308,7 +308,10 @@ test_expect_success 'test allowreachablesha1inwant with unreachable' '
 
 	git init --bare test_reachable.git &&
 	git -C test_reachable.git remote add origin "$HTTPD_URL/smart/repo.git" &&
-	test_must_fail git -C test_reachable.git fetch origin "$(git rev-parse HEAD)"
+	# Some protocol versions (e.g. 2) support fetching
+	# unadvertised objects, so restrict this test to v0.
+	test_must_fail env GIT_TEST_PROTOCOL_VERSION= \
+		git -C test_reachable.git fetch origin "$(git rev-parse HEAD)"
 '
 
 test_expect_success 'test allowanysha1inwant with unreachable' '
@@ -327,7 +330,10 @@ test_expect_success 'test allowanysha1inwant with unreachable' '
 
 	git init --bare test_reachable.git &&
 	git -C test_reachable.git remote add origin "$HTTPD_URL/smart/repo.git" &&
-	test_must_fail git -C test_reachable.git fetch origin "$(git rev-parse HEAD)" &&
+	# Some protocol versions (e.g. 2) support fetching
+	# unadvertised objects, so restrict this test to v0.
+	test_must_fail env GIT_TEST_PROTOCOL_VERSION= \
+		git -C test_reachable.git fetch origin "$(git rev-parse HEAD)" &&
 
 	git -C "$server" config uploadpack.allowanysha1inwant 1 &&
 	git -C test_reachable.git fetch origin "$(git rev-parse HEAD)"
diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
index e87164aa8f..c973278300 100755
--- a/t/t7406-submodule-update.sh
+++ b/t/t7406-submodule-update.sh
@@ -943,7 +943,10 @@ test_expect_success 'submodule update clone shallow submodule outside of depth'
 		cd super3 &&
 		sed -e "s#url = ../#url = file://$pwd/#" <.gitmodules >.gitmodules.tmp &&
 		mv -f .gitmodules.tmp .gitmodules &&
-		test_must_fail git submodule update --init --depth=1 2>actual &&
+		# Some protocol versions (e.g. 2) support fetching
+		# unadvertised objects, so restrict this test to v0.
+		test_must_fail env GIT_TEST_PROTOCOL_VERSION= \
+			git submodule update --init --depth=1 2>actual &&
 		test_i18ngrep "Direct fetching of that commit failed." actual &&
 		git -C ../submodule config uploadpack.allowReachableSHA1InWant true &&
 		git submodule update --init --depth=1 >actual &&
-- 
2.19.0.271.gfe8321ec05.dirty


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [WIP 3/8] t5503: fix overspecification of trace expectation
  2019-01-16 22:42 [WIP 0/8] Trying to revive GIT_TEST_PROTOCOL_VERSION Jonathan Tan
  2019-01-16 22:42 ` [WIP 1/8] tests: define GIT_TEST_PROTOCOL_VERSION Jonathan Tan
  2019-01-16 22:42 ` [WIP 2/8] tests: always test fetch of unreachable with v0 Jonathan Tan
@ 2019-01-16 22:42 ` Jonathan Tan
  2019-01-16 22:42 ` [WIP 4/8] t5512: compensate for v0 only sending HEAD symrefs Jonathan Tan
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Jonathan Tan @ 2019-01-16 22:42 UTC (permalink / raw)
  To: git; +Cc: Jonathan Tan, avarab

In order to extract the wants from a trace, a loop in t5503 currently
breaks if "0000" is found. This works for protocol v0 and v1, but not
v2. Instead, teach t5503 to look specifically for the "want" string,
which is compatible with all protocols.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
---
 t/t5503-tagfollow.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t5503-tagfollow.sh b/t/t5503-tagfollow.sh
index 4ca48f0276..6041a4dd32 100755
--- a/t/t5503-tagfollow.sh
+++ b/t/t5503-tagfollow.sh
@@ -47,7 +47,7 @@ get_needs () {
 	test -s "$1" &&
 	perl -alne '
 		next unless $F[1] eq "upload-pack<";
-		last if $F[2] eq "0000";
+		next unless $F[2] eq "want";
 		print $F[2], " ", $F[3];
 	' "$1"
 }
-- 
2.19.0.271.gfe8321ec05.dirty


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [WIP 4/8] t5512: compensate for v0 only sending HEAD symrefs
  2019-01-16 22:42 [WIP 0/8] Trying to revive GIT_TEST_PROTOCOL_VERSION Jonathan Tan
                   ` (2 preceding siblings ...)
  2019-01-16 22:42 ` [WIP 3/8] t5503: fix overspecification of trace expectation Jonathan Tan
@ 2019-01-16 22:42 ` Jonathan Tan
  2019-01-16 22:42 ` [WIP 5/8] t5700: only run with protocol version 1 Jonathan Tan
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Jonathan Tan @ 2019-01-16 22:42 UTC (permalink / raw)
  To: git; +Cc: Jonathan Tan, avarab

Protocol v2 supports sending non-HEAD symrefs, but this is not true of
protocol v0. Some tests expect protocol v0 behavior, so fix them to use
protocol v0.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
---
 t/t5512-ls-remote.sh | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/t/t5512-ls-remote.sh b/t/t5512-ls-remote.sh
index ca69636fd5..d3bac6f2ee 100755
--- a/t/t5512-ls-remote.sh
+++ b/t/t5512-ls-remote.sh
@@ -223,7 +223,9 @@ test_expect_success 'ls-remote --symref' '
 	$(git rev-parse refs/tags/mark1.10)	refs/tags/mark1.10
 	$(git rev-parse refs/tags/mark1.2)	refs/tags/mark1.2
 	EOF
-	git ls-remote --symref >actual &&
+	# Protocol v2 supports sending symrefs for refs other than HEAD, so use
+	# protocol v0 here.
+	GIT_TEST_PROTOCOL_VERSION= git ls-remote --symref >actual &&
 	test_cmp expect actual
 '
 
@@ -232,7 +234,9 @@ test_expect_success 'ls-remote with filtered symref (refname)' '
 	ref: refs/heads/master	HEAD
 	1bd44cb9d13204b0fe1958db0082f5028a16eb3a	HEAD
 	EOF
-	git ls-remote --symref . HEAD >actual &&
+	# Protocol v2 supports sending symrefs for refs other than HEAD, so use
+	# protocol v0 here.
+	GIT_TEST_PROTOCOL_VERSION= git ls-remote --symref . HEAD >actual &&
 	test_cmp expect actual
 '
 
@@ -243,7 +247,9 @@ test_expect_failure 'ls-remote with filtered symref (--heads)' '
 	1bd44cb9d13204b0fe1958db0082f5028a16eb3a	refs/heads/foo
 	1bd44cb9d13204b0fe1958db0082f5028a16eb3a	refs/heads/master
 	EOF
-	git ls-remote --symref --heads . >actual &&
+	# Protocol v2 supports sending symrefs for refs other than HEAD, so use
+	# protocol v0 here.
+	GIT_TEST_PROTOCOL_VERSION= git ls-remote --symref --heads . >actual &&
 	test_cmp expect actual
 '
 
@@ -252,9 +258,11 @@ test_expect_success 'ls-remote --symref omits filtered-out matches' '
 	1bd44cb9d13204b0fe1958db0082f5028a16eb3a	refs/heads/foo
 	1bd44cb9d13204b0fe1958db0082f5028a16eb3a	refs/heads/master
 	EOF
-	git ls-remote --symref --heads . >actual &&
+	# Protocol v2 supports sending symrefs for refs other than HEAD, so use
+	# protocol v0 here.
+	GIT_TEST_PROTOCOL_VERSION= git ls-remote --symref --heads . >actual &&
 	test_cmp expect actual &&
-	git ls-remote --symref . "refs/heads/*" >actual &&
+	GIT_TEST_PROTOCOL_VERSION= git ls-remote --symref . "refs/heads/*" >actual &&
 	test_cmp expect actual
 '
 
-- 
2.19.0.271.gfe8321ec05.dirty


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [WIP 5/8] t5700: only run with protocol version 1
  2019-01-16 22:42 [WIP 0/8] Trying to revive GIT_TEST_PROTOCOL_VERSION Jonathan Tan
                   ` (3 preceding siblings ...)
  2019-01-16 22:42 ` [WIP 4/8] t5512: compensate for v0 only sending HEAD symrefs Jonathan Tan
@ 2019-01-16 22:42 ` Jonathan Tan
  2019-01-16 22:42 ` [WIP 6/8] tests: fix protocol version for overspecifications Jonathan Tan
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Jonathan Tan @ 2019-01-16 22:42 UTC (permalink / raw)
  To: git; +Cc: Jonathan Tan, avarab

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
---
 t/t5700-protocol-v1.sh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/t/t5700-protocol-v1.sh b/t/t5700-protocol-v1.sh
index 2e56c79233..9857bd0ecb 100755
--- a/t/t5700-protocol-v1.sh
+++ b/t/t5700-protocol-v1.sh
@@ -4,6 +4,9 @@ test_description='test git wire-protocol transition'
 
 TEST_NO_CREATE_REPO=1
 
+# This is a protocol-specific test.
+GIT_TEST_PROTOCOL_VERSION=
+
 . ./test-lib.sh
 
 # Test protocol v1 with 'git://' transport
-- 
2.19.0.271.gfe8321ec05.dirty


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [WIP 6/8] tests: fix protocol version for overspecifications
  2019-01-16 22:42 [WIP 0/8] Trying to revive GIT_TEST_PROTOCOL_VERSION Jonathan Tan
                   ` (4 preceding siblings ...)
  2019-01-16 22:42 ` [WIP 5/8] t5700: only run with protocol version 1 Jonathan Tan
@ 2019-01-16 22:42 ` Jonathan Tan
  2019-01-16 22:42 ` [WIP 7/8] t5552: compensate for v2 filtering ref adv Jonathan Tan
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Jonathan Tan @ 2019-01-16 22:42 UTC (permalink / raw)
  To: git; +Cc: Jonathan Tan, avarab

These tests are also marked with a NEEDSWORK comment.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
---
 t/t5515-fetch-merge-logic.sh  |  4 ++++
 t/t5539-fetch-http-shallow.sh |  5 ++++-
 t/t5541-http-push-smart.sh    | 14 ++++++++++++--
 t/t5551-http-fetch-smart.sh   | 34 ++++++++++++++++++++++++++--------
 4 files changed, 46 insertions(+), 11 deletions(-)

diff --git a/t/t5515-fetch-merge-logic.sh b/t/t5515-fetch-merge-logic.sh
index 36b0dbc01c..e55d8474ef 100755
--- a/t/t5515-fetch-merge-logic.sh
+++ b/t/t5515-fetch-merge-logic.sh
@@ -6,6 +6,10 @@
 
 test_description='Merge logic in fetch'
 
+# NEEDSWORK: If the overspecification of the expected result is reduced, we
+# might be able to run this test in all protocol versions.
+GIT_TEST_PROTOCOL_VERSION=
+
 . ./test-lib.sh
 
 LF='
diff --git a/t/t5539-fetch-http-shallow.sh b/t/t5539-fetch-http-shallow.sh
index 5fbf67c446..cdb687b93a 100755
--- a/t/t5539-fetch-http-shallow.sh
+++ b/t/t5539-fetch-http-shallow.sh
@@ -67,7 +67,10 @@ test_expect_success 'no shallow lines after receiving ACK ready' '
 		cd clone &&
 		git checkout --orphan newnew &&
 		test_commit new-too &&
-		GIT_TRACE_PACKET="$TRASH_DIRECTORY/trace" git fetch --depth=2 &&
+		# NEEDSWORK: If the overspecification of the expected result is reduced, we
+		# might be able to run this test in all protocol versions.
+		GIT_TRACE_PACKET="$TRASH_DIRECTORY/trace" GIT_TEST_PROTOCOL_VERSION= \
+			git fetch --depth=2 &&
 		grep "fetch-pack< ACK .* ready" ../trace &&
 		! grep "fetch-pack> done" ../trace
 	)
diff --git a/t/t5541-http-push-smart.sh b/t/t5541-http-push-smart.sh
index 5475afc052..0e3055ab98 100755
--- a/t/t5541-http-push-smart.sh
+++ b/t/t5541-http-push-smart.sh
@@ -47,7 +47,12 @@ test_expect_success 'no empty path components' '
 	cd "$ROOT_PATH" &&
 	git clone $HTTPD_URL/smart/test_repo.git/ test_repo_clone &&
 
-	check_access_log exp
+	# NEEDSWORK: If the overspecification of the expected result is reduced, we
+	# might be able to run this test in all protocol versions.
+	if test -z "$GIT_TEST_PROTOCOL_VERSION"
+	then
+		check_access_log exp
+	fi
 '
 
 test_expect_success 'clone remote repository' '
@@ -128,7 +133,12 @@ GET  /smart/test_repo.git/info/refs?service=git-receive-pack HTTP/1.1 200
 POST /smart/test_repo.git/git-receive-pack HTTP/1.1 200
 EOF
 test_expect_success 'used receive-pack service' '
-	check_access_log exp
+	# NEEDSWORK: If the overspecification of the expected result is reduced, we
+	# might be able to run this test in all protocol versions.
+	if test -z "$GIT_TEST_PROTOCOL_VERSION"
+	then
+		check_access_log exp
+	fi
 '
 
 test_http_push_nonff "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git \
diff --git a/t/t5551-http-fetch-smart.sh b/t/t5551-http-fetch-smart.sh
index d2661eb338..e8ed185b33 100755
--- a/t/t5551-http-fetch-smart.sh
+++ b/t/t5551-http-fetch-smart.sh
@@ -82,12 +82,18 @@ test_expect_success 'clone http repository' '
 		/^< Content-Length: /d
 		/^< Transfer-Encoding: /d
 	" >actual &&
-	sed -e "s/^> Accept-Encoding: .*/> Accept-Encoding: ENCODINGS/" \
-			actual >actual.smudged &&
-	test_cmp exp actual.smudged &&
 
-	grep "Accept-Encoding:.*gzip" actual >actual.gzip &&
-	test_line_count = 2 actual.gzip
+	# NEEDSWORK: If the overspecification of the expected result is reduced, we
+	# might be able to run this test in all protocol versions.
+	if test -z "$GIT_TEST_PROTOCOL_VERSION"
+	then
+		sed -e "s/^> Accept-Encoding: .*/> Accept-Encoding: ENCODINGS/" \
+				actual >actual.smudged &&
+		test_cmp exp actual.smudged &&
+
+		grep "Accept-Encoding:.*gzip" actual >actual.gzip &&
+		test_line_count = 2 actual.gzip
+	fi
 '
 
 test_expect_success 'fetch changes via http' '
@@ -105,7 +111,13 @@ test_expect_success 'used upload-pack service' '
 	GET  /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1 200
 	POST /smart/repo.git/git-upload-pack HTTP/1.1 200
 	EOF
-	check_access_log exp
+
+	# NEEDSWORK: If the overspecification of the expected result is reduced, we
+	# might be able to run this test in all protocol versions.
+	if test -z "$GIT_TEST_PROTOCOL_VERSION"
+	then
+		check_access_log exp
+	fi
 '
 
 test_expect_success 'follow redirects (301)' '
@@ -217,8 +229,14 @@ test_expect_success 'cookies stored in http.cookiefile when http.savecookies set
 	git config http.cookiefile cookies.txt &&
 	git config http.savecookies true &&
 	git ls-remote $HTTPD_URL/smart_cookies/repo.git master &&
-	tail -3 cookies.txt | sort >cookies_tail.txt &&
-	test_cmp expect_cookies.txt cookies_tail.txt
+
+	# NEEDSWORK: If the overspecification of the expected result is reduced, we
+	# might be able to run this test in all protocol versions.
+	if test -z "$GIT_TEST_PROTOCOL_VERSION"
+	then
+		tail -3 cookies.txt | sort >cookies_tail.txt &&
+		test_cmp expect_cookies.txt cookies_tail.txt
+	fi
 '
 
 test_expect_success 'transfer.hiderefs works over smart-http' '
-- 
2.19.0.271.gfe8321ec05.dirty


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [WIP 7/8] t5552: compensate for v2 filtering ref adv.
  2019-01-16 22:42 [WIP 0/8] Trying to revive GIT_TEST_PROTOCOL_VERSION Jonathan Tan
                   ` (5 preceding siblings ...)
  2019-01-16 22:42 ` [WIP 6/8] tests: fix protocol version for overspecifications Jonathan Tan
@ 2019-01-16 22:42 ` Jonathan Tan
  2019-01-16 22:42 ` [WIP 8/8] remote-curl: in v2, fill credentials if needed Jonathan Tan
  2019-01-17  9:31 ` [WIP 0/8] Trying to revive GIT_TEST_PROTOCOL_VERSION Ævar Arnfjörð Bjarmason
  8 siblings, 0 replies; 12+ messages in thread
From: Jonathan Tan @ 2019-01-16 22:42 UTC (permalink / raw)
  To: git; +Cc: Jonathan Tan, avarab

Protocol v2 filters the ref advertisement, but protocol v0 does not. A
test in t5552 uses the ref advertisement, so fix it to use protocol v0.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
---
 t/t5552-skipping-fetch-negotiator.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/t/t5552-skipping-fetch-negotiator.sh b/t/t5552-skipping-fetch-negotiator.sh
index 30857b84a8..8a14be51a1 100755
--- a/t/t5552-skipping-fetch-negotiator.sh
+++ b/t/t5552-skipping-fetch-negotiator.sh
@@ -127,7 +127,10 @@ test_expect_success 'use ref advertisement to filter out commits' '
 	# not need to send any ancestors of "c3", but we still need to send "c3"
 	# itself.
 	test_config -C client fetch.negotiationalgorithm skipping &&
-	trace_fetch client origin to_fetch &&
+
+	# The ref advertisement itself is filtered when protocol v2 is used, so
+	# use v0.
+	GIT_TEST_PROTOCOL_VERSION= trace_fetch client origin to_fetch &&
 	have_sent c5 c4^ c2side &&
 	have_not_sent c4 c4^^ c4^^^
 '
-- 
2.19.0.271.gfe8321ec05.dirty


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [WIP 8/8] remote-curl: in v2, fill credentials if needed
  2019-01-16 22:42 [WIP 0/8] Trying to revive GIT_TEST_PROTOCOL_VERSION Jonathan Tan
                   ` (6 preceding siblings ...)
  2019-01-16 22:42 ` [WIP 7/8] t5552: compensate for v2 filtering ref adv Jonathan Tan
@ 2019-01-16 22:42 ` Jonathan Tan
  2019-01-17  9:31 ` [WIP 0/8] Trying to revive GIT_TEST_PROTOCOL_VERSION Ævar Arnfjörð Bjarmason
  8 siblings, 0 replies; 12+ messages in thread
From: Jonathan Tan @ 2019-01-16 22:42 UTC (permalink / raw)
  To: git; +Cc: Jonathan Tan, avarab

In post_rpc(), remote-curl calls credential_fill() if HTTP_REAUTH is
returned, but this is not true in proxy_request(). Do this in
proxy_request() too.

When t5551 is run using GIT_TEST_PROTOCOL_VERSION=2, one of the tests
that used to fail now pass.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
---
 remote-curl.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/remote-curl.c b/remote-curl.c
index 0d8fe19cc7..cd6749032a 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -1264,7 +1264,9 @@ static size_t proxy_out(char *buffer, size_t eltsize,
 static int proxy_request(struct proxy_state *p)
 {
 	struct active_request_slot *slot;
+	int err;
 
+retry:
 	slot = get_active_slot();
 
 	curl_easy_setopt(slot->curl, CURLOPT_ENCODING, "");
@@ -1281,7 +1283,12 @@ static int proxy_request(struct proxy_state *p)
 	curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, proxy_out);
 	curl_easy_setopt(slot->curl, CURLOPT_WRITEDATA, p);
 
-	if (run_slot(slot, NULL) != HTTP_OK)
+	err = run_slot(slot, NULL);
+	if (err == HTTP_REAUTH) {
+		credential_fill(&http_auth);
+		goto retry;
+	}
+	if (err != HTTP_OK)
 		return -1;
 
 	return 0;
-- 
2.19.0.271.gfe8321ec05.dirty


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [WIP 0/8] Trying to revive GIT_TEST_PROTOCOL_VERSION
  2019-01-16 22:42 [WIP 0/8] Trying to revive GIT_TEST_PROTOCOL_VERSION Jonathan Tan
                   ` (7 preceding siblings ...)
  2019-01-16 22:42 ` [WIP 8/8] remote-curl: in v2, fill credentials if needed Jonathan Tan
@ 2019-01-17  9:31 ` Ævar Arnfjörð Bjarmason
  2019-01-17 18:37   ` Jonathan Tan
  8 siblings, 1 reply; 12+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2019-01-17  9:31 UTC (permalink / raw)
  To: Jonathan Tan; +Cc: git, Junio C Hamano


On Wed, Jan 16 2019, Jonathan Tan wrote:

> Ævar, are you planning to revive GIT_TEST_PROTOCOL_VERSION? I have
> updated the patchset in light of some new branches that have appeared.
>
> This is on master merged with:
>  - jk/proto-v2-hidden-refs-fix
>  - tg/t5570-drop-racy-test
>  - js/protocol-advertise-multi
>  - jt/upload-pack-deepen-relative-proto-v2
>  - jt/fetch-pack-v2

I'm happy to have you pick that up as you've done here, especially since
you're actually working on v2 and I'm not, so you can more easily know
what it conflicts with etc. I just wanted to have it in one way or
another, i.e. be able to deploy v2 and assert that "next + custom
patches" doesn't break something for v2.

I think [CC: Junio] that we shouldn't be concerned about an addition of
GIT_TEST_PROTOCOL_VERSION patches in any form breaking the test suite
under GIT_TEST_PROTOCOL_VERSION=2, and just be concerned about the
default GIT_TEST_PROTOCOL_VERSION= case. I.e. if we have v2 patches
in-flight that break things no big deal, we can always circle back and
fix those things or annotate the tests.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [WIP 0/8] Trying to revive GIT_TEST_PROTOCOL_VERSION
  2019-01-17  9:31 ` [WIP 0/8] Trying to revive GIT_TEST_PROTOCOL_VERSION Ævar Arnfjörð Bjarmason
@ 2019-01-17 18:37   ` Jonathan Tan
  2019-01-17 21:18     ` Junio C Hamano
  0 siblings, 1 reply; 12+ messages in thread
From: Jonathan Tan @ 2019-01-17 18:37 UTC (permalink / raw)
  To: avarab; +Cc: jonathantanmy, git, gitster

> I'm happy to have you pick that up as you've done here, especially since
> you're actually working on v2 and I'm not, so you can more easily know
> what it conflicts with etc. I just wanted to have it in one way or
> another, i.e. be able to deploy v2 and assert that "next + custom
> patches" doesn't break something for v2.
> 
> I think [CC: Junio] that we shouldn't be concerned about an addition of
> GIT_TEST_PROTOCOL_VERSION patches in any form breaking the test suite
> under GIT_TEST_PROTOCOL_VERSION=2, and just be concerned about the
> default GIT_TEST_PROTOCOL_VERSION= case. I.e. if we have v2 patches
> in-flight that break things no big deal, we can always circle back and
> fix those things or annotate the tests.

That sounds good to me. My main concern is that this will end up being
dead code (if we have too many tests that fail with
GIT_TEST_PROTOCOL_VERSION=2 and no one bothers with it anymore), but I
don't think that will happen - in this patch set, I have eliminated a
lot of false failures and strove to give reasons for the
GIT_TEST_PROTOCOL_VERSION= annotations, and I think there's interest
(well, at least from me) in investigating the remaining apparent bugs.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [WIP 0/8] Trying to revive GIT_TEST_PROTOCOL_VERSION
  2019-01-17 18:37   ` Jonathan Tan
@ 2019-01-17 21:18     ` Junio C Hamano
  0 siblings, 0 replies; 12+ messages in thread
From: Junio C Hamano @ 2019-01-17 21:18 UTC (permalink / raw)
  To: Jonathan Tan; +Cc: avarab, git

Jonathan Tan <jonathantanmy@google.com> writes:

>> I'm happy to have you pick that up as you've done here, especially since
>> you're actually working on v2 and I'm not, so you can more easily know
>> what it conflicts with etc. I just wanted to have it in one way or
>> another, i.e. be able to deploy v2 and assert that "next + custom
>> patches" doesn't break something for v2.
>> 
>> I think [CC: Junio] that we shouldn't be concerned about an addition of
>> GIT_TEST_PROTOCOL_VERSION patches in any form breaking the test suite
>> under GIT_TEST_PROTOCOL_VERSION=2, and just be concerned about the
>> default GIT_TEST_PROTOCOL_VERSION= case. I.e. if we have v2 patches
>> in-flight that break things no big deal, we can always circle back and
>> fix those things or annotate the tests.
>
> That sounds good to me. My main concern is that this will end up being
> dead code (if we have too many tests that fail with
> GIT_TEST_PROTOCOL_VERSION=2 and no one bothers with it anymore), but I
> don't think that will happen - in this patch set, I have eliminated a
> lot of false failures and strove to give reasons for the
> GIT_TEST_PROTOCOL_VERSION= annotations, and I think there's interest
> (well, at least from me) in investigating the remaining apparent bugs.

Yup, sounds good to me, too.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-01-17 21:18 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-16 22:42 [WIP 0/8] Trying to revive GIT_TEST_PROTOCOL_VERSION Jonathan Tan
2019-01-16 22:42 ` [WIP 1/8] tests: define GIT_TEST_PROTOCOL_VERSION Jonathan Tan
2019-01-16 22:42 ` [WIP 2/8] tests: always test fetch of unreachable with v0 Jonathan Tan
2019-01-16 22:42 ` [WIP 3/8] t5503: fix overspecification of trace expectation Jonathan Tan
2019-01-16 22:42 ` [WIP 4/8] t5512: compensate for v0 only sending HEAD symrefs Jonathan Tan
2019-01-16 22:42 ` [WIP 5/8] t5700: only run with protocol version 1 Jonathan Tan
2019-01-16 22:42 ` [WIP 6/8] tests: fix protocol version for overspecifications Jonathan Tan
2019-01-16 22:42 ` [WIP 7/8] t5552: compensate for v2 filtering ref adv Jonathan Tan
2019-01-16 22:42 ` [WIP 8/8] remote-curl: in v2, fill credentials if needed Jonathan Tan
2019-01-17  9:31 ` [WIP 0/8] Trying to revive GIT_TEST_PROTOCOL_VERSION Ævar Arnfjörð Bjarmason
2019-01-17 18:37   ` Jonathan Tan
2019-01-17 21:18     ` Junio C Hamano

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).