Skip to content

Commit 01f8d59

Browse files
peffgitster
authored andcommitted
prefer "hash mismatch" to "sha1 mismatch"
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>
1 parent 2c31988 commit 01f8d59

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

Documentation/git-fsck.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ dangling <type> <object>::
140140
The <type> object <object>, is present in the database but never
141141
'directly' used. A dangling commit could be a root node.
142142

143-
sha1 mismatch <object>::
144-
The database has an object who's sha1 doesn't match the
145-
database value.
143+
hash mismatch <object>::
144+
The database has an object whose hash doesn't match the
145+
object database value.
146146
This indicates a serious data integrity problem.
147147

148148
Environment Variables

object.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ struct object *parse_object(struct repository *r, const struct object_id *oid)
263263
(!obj && has_object_file(oid) &&
264264
oid_object_info(r, oid, NULL) == OBJ_BLOB)) {
265265
if (check_object_signature(repl, NULL, 0, NULL) < 0) {
266-
error(_("sha1 mismatch %s"), oid_to_hex(oid));
266+
error(_("hash mismatch %s"), oid_to_hex(oid));
267267
return NULL;
268268
}
269269
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)
274274
if (buffer) {
275275
if (check_object_signature(repl, buffer, size, type_name(type)) < 0) {
276276
free(buffer);
277-
error(_("sha1 mismatch %s"), oid_to_hex(repl));
277+
error(_("hash mismatch %s"), oid_to_hex(repl));
278278
return NULL;
279279
}
280280

sha1-file.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2218,7 +2218,7 @@ static int check_stream_oid(git_zstream *stream,
22182218

22192219
the_hash_algo->final_fn(real_oid.hash, &c);
22202220
if (!oideq(expected_oid, &real_oid)) {
2221-
error(_("sha1 mismatch for %s (expected %s)"), path,
2221+
error(_("hash mismatch for %s (expected %s)"), path,
22222222
oid_to_hex(expected_oid));
22232223
return -1;
22242224
}
@@ -2270,7 +2270,7 @@ int read_loose_object(const char *path,
22702270
}
22712271
if (check_object_signature(expected_oid, *contents,
22722272
*size, type_name(*type))) {
2273-
error(_("sha1 mismatch for %s (expected %s)"), path,
2273+
error(_("hash mismatch for %s (expected %s)"), path,
22742274
oid_to_hex(expected_oid));
22752275
free(*contents);
22762276
goto out;

t/t1450-fsck.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ test_expect_success 'rev-list --verify-objects with bad sha1' '
406406
407407
test_might_fail git rev-list --verify-objects refs/heads/bogus >/dev/null 2>out &&
408408
cat out &&
409-
test_i18ngrep -q "error: sha1 mismatch 63ffffffffffffffffffffffffffffffffffffff" out
409+
test_i18ngrep -q "error: hash mismatch 63ffffffffffffffffffffffffffffffffffffff" out
410410
'
411411

412412
test_expect_success 'force fsck to ignore double author' '

0 commit comments

Comments
 (0)