prefer "hash mismatch" to "sha1 mismatch"
authorJeff King <peff@peff.net>
Mon, 7 Jan 2019 08:40:34 +0000 (03:40 -0500)
committerJunio C Hamano <gitster@pobox.com>
Tue, 8 Jan 2019 17:41:06 +0000 (09:41 -0800)
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-fsck.txt
object.c
sha1-file.c
t/t1450-fsck.sh
index ab9a93fb9b8fb7291362cc419a7aca8b464d3d76..55950d9eea9edb5157352fa3e6316ef3507e99bf 100644 (file)
@@ -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
index a5c5cf830fc52d03adb4283cafd097218e1117a0..df72914bdc54292b8e0fad722c3eefd238496ec7 100644 (file)
--- 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;
                }
 
index 39cdf378a54d8309e85db097c848169628e54cbc..23564598f2bc17c6bc55b97e6a64ee356652045b 100644 (file)
@@ -2218,7 +2218,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;
        }
@@ -2270,7 +2270,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;
index 2e5e979336c5c67bf59667bbf5e0183b632ea2da..c61f97214137f5fcf5a9d6b7dd98ea8162e9916d 100755 (executable)
@@ -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' '