зеркало из https://github.com/microsoft/git.git
fsck: drop blob struct from fsck_finish()
Since fsck_blob() no longer requires us to have a "struct blob", we don't need to create one. Which also means we don't need to worry about handling the case that lookup_blob() returns NULL (we'll still catch wrongly-identified blobs when we read the actual object contents and type from disk). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
6da40b22ca
Коммит
b8b00f1693
18
fsck.c
18
fsck.c
|
@ -1013,7 +1013,6 @@ int fsck_finish(struct fsck_options *options)
|
||||||
|
|
||||||
oidset_iter_init(&gitmodules_found, &iter);
|
oidset_iter_init(&gitmodules_found, &iter);
|
||||||
while ((oid = oidset_iter_next(&iter))) {
|
while ((oid = oidset_iter_next(&iter))) {
|
||||||
struct blob *blob;
|
|
||||||
enum object_type type;
|
enum object_type type;
|
||||||
unsigned long size;
|
unsigned long size;
|
||||||
char *buf;
|
char *buf;
|
||||||
|
@ -1021,31 +1020,22 @@ int fsck_finish(struct fsck_options *options)
|
||||||
if (oidset_contains(&gitmodules_done, oid))
|
if (oidset_contains(&gitmodules_done, oid))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
blob = lookup_blob(the_repository, oid);
|
|
||||||
if (!blob) {
|
|
||||||
struct object *obj = lookup_unknown_object(oid);
|
|
||||||
ret |= report(options, &obj->oid, obj->type,
|
|
||||||
FSCK_MSG_GITMODULES_BLOB,
|
|
||||||
"non-blob found at .gitmodules");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
buf = read_object_file(oid, &type, &size);
|
buf = read_object_file(oid, &type, &size);
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
if (is_promisor_object(&blob->object.oid))
|
if (is_promisor_object(oid))
|
||||||
continue;
|
continue;
|
||||||
ret |= report(options,
|
ret |= report(options,
|
||||||
&blob->object.oid, blob->object.type,
|
oid, OBJ_BLOB,
|
||||||
FSCK_MSG_GITMODULES_MISSING,
|
FSCK_MSG_GITMODULES_MISSING,
|
||||||
"unable to read .gitmodules blob");
|
"unable to read .gitmodules blob");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == OBJ_BLOB)
|
if (type == OBJ_BLOB)
|
||||||
ret |= fsck_blob(&blob->object.oid, buf, size, options);
|
ret |= fsck_blob(oid, buf, size, options);
|
||||||
else
|
else
|
||||||
ret |= report(options,
|
ret |= report(options,
|
||||||
&blob->object.oid, blob->object.type,
|
oid, type,
|
||||||
FSCK_MSG_GITMODULES_BLOB,
|
FSCK_MSG_GITMODULES_BLOB,
|
||||||
"non-blob found at .gitmodules");
|
"non-blob found at .gitmodules");
|
||||||
free(buf);
|
free(buf);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче