Merge branch 'jt/sha1-file-remove-oi-skip-cached'

has_object_file() said "no" given an object registered to the
system via pretend_object_file(), making it inconsistent with
read_object_file(), causing lazy fetch to attempt fetching an
empty tree from promisor remotes.

* jt/sha1-file-remove-oi-skip-cached:
  sha1-file: remove OBJECT_INFO_SKIP_CACHED
maint
Junio C Hamano 2020-01-22 15:07:30 -08:00
commit e26bd14c8d
2 changed files with 18 additions and 22 deletions

View File

@ -292,8 +292,6 @@ struct object_info {
#define OBJECT_INFO_LOOKUP_REPLACE 1 #define OBJECT_INFO_LOOKUP_REPLACE 1
/* Allow reading from a loose object file of unknown/bogus type */ /* Allow reading from a loose object file of unknown/bogus type */
#define OBJECT_INFO_ALLOW_UNKNOWN_TYPE 2 #define OBJECT_INFO_ALLOW_UNKNOWN_TYPE 2
/* Do not check cached storage */
#define OBJECT_INFO_SKIP_CACHED 4
/* Do not retry packed storage after checking packed and loose storage */ /* Do not retry packed storage after checking packed and loose storage */
#define OBJECT_INFO_QUICK 8 #define OBJECT_INFO_QUICK 8
/* Do not check loose object */ /* Do not check loose object */

View File

@ -1417,6 +1417,7 @@ int oid_object_info_extended(struct repository *r, const struct object_id *oid,
struct object_info *oi, unsigned flags) struct object_info *oi, unsigned flags)
{ {
static struct object_info blank_oi = OBJECT_INFO_INIT; static struct object_info blank_oi = OBJECT_INFO_INIT;
struct cached_object *co;
struct pack_entry e; struct pack_entry e;
int rtype; int rtype;
const struct object_id *real = oid; const struct object_id *real = oid;
@ -1431,8 +1432,7 @@ int oid_object_info_extended(struct repository *r, const struct object_id *oid,
if (!oi) if (!oi)
oi = &blank_oi; oi = &blank_oi;


if (!(flags & OBJECT_INFO_SKIP_CACHED)) { co = find_cached_object(real);
struct cached_object *co = find_cached_object(real);
if (co) { if (co) {
if (oi->typep) if (oi->typep)
*(oi->typep) = co->type; *(oi->typep) = co->type;
@ -1449,7 +1449,6 @@ int oid_object_info_extended(struct repository *r, const struct object_id *oid,
oi->whence = OI_CACHED; oi->whence = OI_CACHED;
return 0; return 0;
} }
}


while (1) { while (1) {
if (find_pack_entry(r, real, &e)) if (find_pack_entry(r, real, &e))
@ -1932,8 +1931,7 @@ int repo_has_object_file_with_flags(struct repository *r,
{ {
if (!startup_info->have_repository) if (!startup_info->have_repository)
return 0; return 0;
return oid_object_info_extended(r, oid, NULL, return oid_object_info_extended(r, oid, NULL, flags) >= 0;
flags | OBJECT_INFO_SKIP_CACHED) >= 0;
} }


int repo_has_object_file(struct repository *r, int repo_has_object_file(struct repository *r,