Re: [PATCH v2 31/39] bundle: add new version for use with SHA-256

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Mon, 13 Jul 2020, SZEDER Gábor wrote:

> On Mon, Jul 13, 2020 at 02:49:01AM +0000, brian m. carlson wrote:
> > @@ -23,17 +24,20 @@ static void add_to_ref_list(const struct object_id *oid, const char *name,
> >  	list->nr++;
> >  }
> >
> > -static const struct git_hash_algo *detect_hash_algo(struct strbuf *buf)
> > +static int parse_capability(struct bundle_header *header, const char *capability)
> >  {
> > -	size_t len = strcspn(buf->buf, " \n");
> > -	int algo;
> > -
> > -	algo = hash_algo_by_length(len / 2);
> > -	if (algo == GIT_HASH_UNKNOWN)
> > -		return NULL;
> > -	return &hash_algos[algo];
> > +	const char *arg;
> > +	if (skip_prefix(capability, "object-format=", &arg)) {
> > +		int algo = hash_algo_by_name(arg);
> > +		if (algo == GIT_HASH_UNKNOWN)
> > +			return error(_("unable to detect hash algorithm"));
> > +		header->hash_algo = &hash_algos[algo];
> > +		return 0;
> > +	}
> > +	return error(_("unknown capability '%s'"), capability);
> >  }
>
>
> > +test_expect_success 'git bundle v3 rejects unknown extensions' '
> > +	head -n2 bundle >new &&
> > +	echo "@unknown=silly" >>new &&
> > +	sed "1,2d" >>new &&
> > +	test_must_fail git bundle verify new 2>output &&
> > +	grep "unknown capability .unknown=silly." output
>
> This "unknown capability" error message is translated, so it should be
> checked with 'test_i18ngrep'.

In other words, this patch (which makes things work over here):

-- snipsnap --
Subject: [PATCH] fixup! bundle: add new version for use with SHA-256

---
 t/t5607-clone-bundle.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t5607-clone-bundle.sh b/t/t5607-clone-bundle.sh
index 4a2a3968cc1..ca4efd88d4a 100755
--- a/t/t5607-clone-bundle.sh
+++ b/t/t5607-clone-bundle.sh
@@ -118,7 +118,7 @@ test_expect_success 'git bundle v3 rejects unknown extensions' '
 	echo "@unknown=silly" >>new &&
 	sed "1,2d" >>new &&
 	test_must_fail git bundle verify new 2>output &&
-	grep "unknown capability .unknown=silly." output
+	test_i18ngrep "unknown capability .unknown=silly." output
 '

 test_done
--
2.26.0.windows.1

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux