threads / patch / 53844

patchbundle: improve message when unknown hash algorithm detected

Subject: [PATCH] bundle: improve message when unknown hash algorithm detected

## tl;dr

2 messages between Jul 12, 2020 and Jul 12, 2020. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

brian m. carlson· Jul 12, 2020, 16:50 UTC · lore

The current code states "unknown hash algorithm length". This is slightly confusing, and moreover, we've gotten feedback that it's hard to translate into other languages. Since the case is that we cannot detect the hash algorithm, let's just say that. This is clearer and more direct, reflects the intent of the code (which calls the function detect_hash_algo just a few lines above), and will be easier to translate.

Suggested-by: Matthias Rüster <matthias.ruester@gmail.com>
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
Matthias contacted me privately about this message and I thought since
we're still in the RC period, it would make sense to include this in to
help translators and those who aren't native speakers.
 bundle.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to bundle.c +1 −1
diff --git a/bundle.c b/bundle.c
index 2a0d744d3f..69c807bda9 100644
--- a/bundle.c
+++ b/bundle.c
@@ -66,7 +66,7 @@ static int parse_bundle_header(int fd, struct bundle_header *header,
 		if (!header->hash_algo) {
 			header->hash_algo = detect_hash_algo(&buf);
 			if (!header->hash_algo) {
-				error(_("unknown hash algorithm length"));
+				error(_("unable to detect hash algorithm"));
 				status = -1;
 				break;
 			}
Junio C Hamano· Jul 12, 2020, 18:10 UTC · re: brian m. carlson · lore

Re: [PATCH] bundle: improve message when unknown hash algorithm detected

"brian m. carlson" <sandals@crustytoothpaste.net> writes:
Show 14 quoted lines
> The current code states "unknown hash algorithm length".  This is
> slightly confusing, and moreover, we've gotten feedback that it's hard
> to translate into other languages.  Since the case is that we cannot
> detect the hash algorithm, let's just say that.  This is clearer and
> more direct, reflects the intent of the code (which calls the function
> detect_hash_algo just a few lines above), and will be easier to
> translate.
>
> Suggested-by: Matthias Rüster <matthias.ruester@gmail.com>
> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
> ---
> Matthias contacted me privately about this message and I thought since
> we're still in the RC period, it would make sense to include this in to
> help translators and those who aren't native speakers.

Yup, and yuck. Didn't we find any room in the bundle header to sneak in the actual hash algorithm name in a backward compatible way? I am actually OK if we declared that v2 bundle files are SHA-1 only and v3 bundle file has an item in the bundle header to say what hash algorithm is used, than using "ah this uses a hash algorithm that produces a 32-byte output, so it must be algorithm X", to be honest.

Show 16 quoted lines
>  bundle.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/bundle.c b/bundle.c
> index 2a0d744d3f..69c807bda9 100644
> --- a/bundle.c
> +++ b/bundle.c
> @@ -66,7 +66,7 @@ static int parse_bundle_header(int fd, struct bundle_header *header,
>  		if (!header->hash_algo) {
>  			header->hash_algo = detect_hash_algo(&buf);
>  			if (!header->hash_algo) {
> -				error(_("unknown hash algorithm length"));
> +				error(_("unable to detect hash algorithm"));
>  				status = -1;
>  				break;
>  			}

← back to recent threads