int has_object(struct repository *r, const struct object_id *oid,
unsigned flags)
{
- int quick = !(flags & HAS_OBJECT_RECHECK_PACKED);
- unsigned object_info_flags = OBJECT_INFO_SKIP_FETCH_OBJECT |
- (quick ? OBJECT_INFO_QUICK : 0);
+ unsigned object_info_flags = 0;
if (!startup_info->have_repository)
return 0;
+ if (!(flags & HAS_OBJECT_RECHECK_PACKED))
+ object_info_flags |= OBJECT_INFO_QUICK;
+ if (!(flags & HAS_OBJECT_FETCH_PROMISOR))
+ object_info_flags |= OBJECT_INFO_SKIP_FETCH_OBJECT;
+
return oid_object_info_extended(r, oid, NULL, object_info_flags) >= 0;
}
const struct object_id *,
struct object_info *, unsigned flags);
-/* Retry packed storage after checking packed and loose storage */
-#define HAS_OBJECT_RECHECK_PACKED 1
+enum {
+ /* Retry packed storage after checking packed and loose storage */
+ HAS_OBJECT_RECHECK_PACKED = (1 << 0),
+ /* Allow fetching the object in case the repository has a promisor remote. */
+ HAS_OBJECT_FETCH_PROMISOR = (1 << 1),
+};
/*
* Returns 1 if the object exists. This function will not lazily fetch objects
- * in a partial clone.
+ * in a partial clone by default.
*/
int has_object(struct repository *r, const struct object_id *oid,
unsigned flags);