All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: "René Scharfe" <l.s.r@web.de>
Cc: git@vger.kernel.org, "Junio C Hamano" <gitster@pobox.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH 11/11] prefer "hash mismatch" to "sha1 mismatch"
Date: Mon, 7 Jan 2019 03:40:34 -0500	[thread overview]
Message-ID: <20190107084033.GK29431@sigill.intra.peff.net> (raw)
In-Reply-To: <20190107083150.GC21362@sigill.intra.peff.net>

To future-proof ourselves against a change in the hash, let's use the
more generic "hash mismatch" to refer to integrity problems. Note that
we do advertise this exact string in git-fsck(1). However, the message
itself is marked for translation, meaning we do not expect it to be
machine-readable.

While we're touching that documentation, let's also update it for
grammar and clarity.

Signed-off-by: Jeff King <peff@peff.net>
---
I'm actually a little nervous that we _shouldn't_ have marked the
messages that fsck produces for translation (and nor should we change
them here, but then we're stuck with the word "sha1" forever).

I actually think fsck ought to have a machine-readable output format,
but of course that does not help any existing scripts.

 Documentation/git-fsck.txt | 6 +++---
 object.c                   | 4 ++--
 sha1-file.c                | 4 ++--
 t/t1450-fsck.sh            | 2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/Documentation/git-fsck.txt b/Documentation/git-fsck.txt
index ab9a93fb9b..55950d9eea 100644
--- a/Documentation/git-fsck.txt
+++ b/Documentation/git-fsck.txt
@@ -140,9 +140,9 @@ dangling <type> <object>::
 	The <type> object <object>, is present in the database but never
 	'directly' used. A dangling commit could be a root node.
 
-sha1 mismatch <object>::
-	The database has an object who's sha1 doesn't match the
-	database value.
+hash mismatch <object>::
+	The database has an object whose hash doesn't match the
+	object database value.
 	This indicates a serious data integrity problem.
 
 Environment Variables
diff --git a/object.c b/object.c
index a5c5cf830f..df72914bdc 100644
--- a/object.c
+++ b/object.c
@@ -263,7 +263,7 @@ struct object *parse_object(struct repository *r, const struct object_id *oid)
 	    (!obj && has_object_file(oid) &&
 	     oid_object_info(r, oid, NULL) == OBJ_BLOB)) {
 		if (check_object_signature(repl, NULL, 0, NULL) < 0) {
-			error(_("sha1 mismatch %s"), oid_to_hex(oid));
+			error(_("hash mismatch %s"), oid_to_hex(oid));
 			return NULL;
 		}
 		parse_blob_buffer(lookup_blob(r, oid), NULL, 0);
@@ -274,7 +274,7 @@ struct object *parse_object(struct repository *r, const struct object_id *oid)
 	if (buffer) {
 		if (check_object_signature(repl, buffer, size, type_name(type)) < 0) {
 			free(buffer);
-			error(_("sha1 mismatch %s"), oid_to_hex(repl));
+			error(_("hash mismatch %s"), oid_to_hex(repl));
 			return NULL;
 		}
 
diff --git a/sha1-file.c b/sha1-file.c
index 55a4782844..a5726c3e73 100644
--- a/sha1-file.c
+++ b/sha1-file.c
@@ -2223,7 +2223,7 @@ static int check_stream_oid(git_zstream *stream,
 
 	the_hash_algo->final_fn(real_oid.hash, &c);
 	if (!oideq(expected_oid, &real_oid)) {
-		error(_("sha1 mismatch for %s (expected %s)"), path,
+		error(_("hash mismatch for %s (expected %s)"), path,
 		      oid_to_hex(expected_oid));
 		return -1;
 	}
@@ -2275,7 +2275,7 @@ int read_loose_object(const char *path,
 		}
 		if (check_object_signature(expected_oid, *contents,
 					 *size, type_name(*type))) {
-			error(_("sha1 mismatch for %s (expected %s)"), path,
+			error(_("hash mismatch for %s (expected %s)"), path,
 			      oid_to_hex(expected_oid));
 			free(*contents);
 			goto out;
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
index 2e5e979336..c61f972141 100755
--- a/t/t1450-fsck.sh
+++ b/t/t1450-fsck.sh
@@ -406,7 +406,7 @@ test_expect_success 'rev-list --verify-objects with bad sha1' '
 
 	test_might_fail git rev-list --verify-objects refs/heads/bogus >/dev/null 2>out &&
 	cat out &&
-	test_i18ngrep -q "error: sha1 mismatch 63ffffffffffffffffffffffffffffffffffffff" out
+	test_i18ngrep -q "error: hash mismatch 63ffffffffffffffffffffffffffffffffffffff" out
 '
 
 test_expect_success 'force fsck to ignore double author' '
-- 
2.20.1.470.g640a3e2614

  parent reply	other threads:[~2019-01-07  8:40 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-28 18:04 What's cooking in git.git (Dec 2018, #02; Fri, 28) Junio C Hamano
2018-12-28 18:23 ` Elijah Newren
2019-01-03 13:27   ` Johannes Schindelin
2019-01-07 17:13     ` Elijah Newren
2018-12-28 19:21 ` ag/sequencer-reduce-rewriting-todo, was " Alban Gruin
2018-12-28 20:28   ` Junio C Hamano
2018-12-29 12:08 ` Denton Liu
2019-01-03 13:23 ` ps/stash-in-c, was " Johannes Schindelin
2019-01-06 16:39 ` jk/loose-object-cache René Scharfe
2019-01-06 16:45   ` [PATCH 1/3] object-store: factor out odb_loose_cache() René Scharfe
2019-01-07  8:27     ` Jeff King
2019-01-07 13:26       ` René Scharfe
2019-01-07 17:29         ` René Scharfe
2019-01-07 11:27     ` Philip Oakley
2019-01-07 12:30       ` Jeff King
2019-01-07 13:11         ` René Scharfe
2019-01-06 16:45   ` [PATCH 2/3] object-store: factor out odb_clear_loose_cache() René Scharfe
2019-01-06 16:45   ` [PATCH 3/3] object-store: use one oid_array per subdirectory for loose cache René Scharfe
2019-01-06 20:38     ` Ævar Arnfjörð Bjarmason
2019-01-06 22:58       ` René Scharfe
2019-01-07  8:31   ` [PATCH 0/11] jk/loose-object-cache sha1/object_id fixups Jeff King
2019-01-07  8:33     ` [PATCH 01/11] sha1-file: fix outdated sha1 comment references Jeff King
2019-01-07  8:34     ` [PATCH 02/11] update comment references to sha1_object_info() Jeff King
2019-01-07  8:34     ` [PATCH 03/11] http: use struct object_id instead of bare sha1 Jeff King
2019-01-07  8:35     ` [PATCH 04/11] sha1-file: modernize loose object file functions Jeff King
2019-01-07  8:37     ` [PATCH 05/11] sha1-file: modernize loose header/stream functions Jeff King
2019-01-07  8:37     ` [PATCH 06/11] sha1-file: convert pass-through functions to object_id Jeff King
2019-01-07  8:37     ` [PATCH 07/11] convert has_sha1_file() callers to has_object_file() Jeff King
2019-01-07  8:39     ` [PATCH 08/11] sha1-file: drop has_sha1_file() Jeff King
2019-01-07  8:39     ` [PATCH 09/11] sha1-file: prefer "loose object file" to "sha1 file" in messages Jeff King
2019-01-07  8:39     ` [PATCH 10/11] sha1-file: avoid "sha1 file" for generic use " Jeff King
2019-01-07  8:40     ` Jeff King [this message]
2019-01-08 16:40     ` [PATCH 0/11] jk/loose-object-cache sha1/object_id fixups René Scharfe
2019-01-08 17:39       ` Junio C Hamano
2019-01-08 18:05         ` Jeff King
2019-01-08 18:07           ` Junio C Hamano
2019-01-08 18:27             ` Derrick Stolee
2019-01-08 18:52             ` Junio C Hamano
2019-01-08 21:16               ` Jeff King
2019-01-09 21:37                 ` Stefan Beller
2019-01-09 22:42                   ` Stefan Beller
2019-01-10  6:17                     ` Jeff King
2019-01-07 17:29   ` [PATCH 4/3] object-store: retire odb_load_loose_cache() René Scharfe
2019-01-07 19:32     ` Junio C Hamano
2019-01-07 19:29   ` jk/loose-object-cache Junio C Hamano

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=20190107084033.GK29431@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=l.s.r@web.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.