Skip to content

Commit 1c02840

Browse files
newrengitster
authored andcommitted
object-store.h: move struct object_info from cache.h
Move struct object_info, and a few related #define's from cache.h to object-store.h. A surprising effect of this change is that replace-object.h, which includes object-store.h, now needs to directly include cache.h since that is where read_replace_refs is declared and that variable is used in one of its inline functions. The next commit will move that declaration and fix that unfortunate new direct inclusion of cache.h. Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ac48adf commit 1c02840

File tree

4 files changed

+67
-65
lines changed

4 files changed

+67
-65
lines changed

merge-blobs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "cache.h"
1+
#include "git-compat-util.h"
22
#include "run-command.h"
33
#include "xdiff-interface.h"
44
#include "ll-merge.h"

object-store.h

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef OBJECT_STORE_H
22
#define OBJECT_STORE_H
33

4-
#include "cache.h"
4+
#include "object.h"
55
#include "oidmap.h"
66
#include "list.h"
77
#include "oid-array.h"
@@ -284,6 +284,69 @@ int pretend_object_file(void *, unsigned long, enum object_type,
284284

285285
int force_object_loose(const struct object_id *oid, time_t mtime);
286286

287+
struct object_info {
288+
/* Request */
289+
enum object_type *typep;
290+
unsigned long *sizep;
291+
off_t *disk_sizep;
292+
struct object_id *delta_base_oid;
293+
struct strbuf *type_name;
294+
void **contentp;
295+
296+
/* Response */
297+
enum {
298+
OI_CACHED,
299+
OI_LOOSE,
300+
OI_PACKED,
301+
OI_DBCACHED
302+
} whence;
303+
union {
304+
/*
305+
* struct {
306+
* ... Nothing to expose in this case
307+
* } cached;
308+
* struct {
309+
* ... Nothing to expose in this case
310+
* } loose;
311+
*/
312+
struct {
313+
struct packed_git *pack;
314+
off_t offset;
315+
unsigned int is_delta;
316+
} packed;
317+
} u;
318+
};
319+
320+
/*
321+
* Initializer for a "struct object_info" that wants no items. You may
322+
* also memset() the memory to all-zeroes.
323+
*/
324+
#define OBJECT_INFO_INIT { 0 }
325+
326+
/* Invoke lookup_replace_object() on the given hash */
327+
#define OBJECT_INFO_LOOKUP_REPLACE 1
328+
/* Allow reading from a loose object file of unknown/bogus type */
329+
#define OBJECT_INFO_ALLOW_UNKNOWN_TYPE 2
330+
/* Do not retry packed storage after checking packed and loose storage */
331+
#define OBJECT_INFO_QUICK 8
332+
/*
333+
* Do not attempt to fetch the object if missing (even if fetch_is_missing is
334+
* nonzero).
335+
*/
336+
#define OBJECT_INFO_SKIP_FETCH_OBJECT 16
337+
/*
338+
* This is meant for bulk prefetching of missing blobs in a partial
339+
* clone. Implies OBJECT_INFO_SKIP_FETCH_OBJECT and OBJECT_INFO_QUICK
340+
*/
341+
#define OBJECT_INFO_FOR_PREFETCH (OBJECT_INFO_SKIP_FETCH_OBJECT | OBJECT_INFO_QUICK)
342+
343+
/* Die if object corruption (not just an object being missing) was detected. */
344+
#define OBJECT_INFO_DIE_IF_CORRUPT 32
345+
346+
int oid_object_info_extended(struct repository *r,
347+
const struct object_id *,
348+
struct object_info *, unsigned flags);
349+
287350
/*
288351
* Open the loose object at path, check its hash, and return the contents,
289352
* use the "oi" argument to assert things about the object, or e.g. populate its
@@ -381,69 +444,6 @@ static inline void obj_read_unlock(void)
381444
pthread_mutex_unlock(&obj_read_mutex);
382445
}
383446

384-
struct object_info {
385-
/* Request */
386-
enum object_type *typep;
387-
unsigned long *sizep;
388-
off_t *disk_sizep;
389-
struct object_id *delta_base_oid;
390-
struct strbuf *type_name;
391-
void **contentp;
392-
393-
/* Response */
394-
enum {
395-
OI_CACHED,
396-
OI_LOOSE,
397-
OI_PACKED,
398-
OI_DBCACHED
399-
} whence;
400-
union {
401-
/*
402-
* struct {
403-
* ... Nothing to expose in this case
404-
* } cached;
405-
* struct {
406-
* ... Nothing to expose in this case
407-
* } loose;
408-
*/
409-
struct {
410-
struct packed_git *pack;
411-
off_t offset;
412-
unsigned int is_delta;
413-
} packed;
414-
} u;
415-
};
416-
417-
/*
418-
* Initializer for a "struct object_info" that wants no items. You may
419-
* also memset() the memory to all-zeroes.
420-
*/
421-
#define OBJECT_INFO_INIT { 0 }
422-
423-
/* Invoke lookup_replace_object() on the given hash */
424-
#define OBJECT_INFO_LOOKUP_REPLACE 1
425-
/* Allow reading from a loose object file of unknown/bogus type */
426-
#define OBJECT_INFO_ALLOW_UNKNOWN_TYPE 2
427-
/* Do not retry packed storage after checking packed and loose storage */
428-
#define OBJECT_INFO_QUICK 8
429-
/*
430-
* Do not attempt to fetch the object if missing (even if fetch_is_missing is
431-
* nonzero).
432-
*/
433-
#define OBJECT_INFO_SKIP_FETCH_OBJECT 16
434-
/*
435-
* This is meant for bulk prefetching of missing blobs in a partial
436-
* clone. Implies OBJECT_INFO_SKIP_FETCH_OBJECT and OBJECT_INFO_QUICK
437-
*/
438-
#define OBJECT_INFO_FOR_PREFETCH (OBJECT_INFO_SKIP_FETCH_OBJECT | OBJECT_INFO_QUICK)
439-
440-
/* Die if object corruption (not just an object being missing) was detected. */
441-
#define OBJECT_INFO_DIE_IF_CORRUPT 32
442-
443-
int oid_object_info_extended(struct repository *r,
444-
const struct object_id *,
445-
struct object_info *, unsigned flags);
446-
447447
/*
448448
* Iterate over the files in the loose-object parts of the object
449449
* directory "path", triggering the following callbacks:

protocol-caps.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "pkt-line.h"
66
#include "strvec.h"
77
#include "hash.h"
8+
#include "hex.h"
89
#include "object.h"
910
#include "object-store.h"
1011
#include "string-list.h"

replace-object.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#ifndef REPLACE_OBJECT_H
22
#define REPLACE_OBJECT_H
33

4+
#include "cache.h"
45
#include "oidmap.h"
56
#include "repository.h"
67
#include "object-store.h"

0 commit comments

Comments
 (0)