Re: [PATCH v2 1/8] sha1_file: allow to select pack origin when looking up an object
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Apr 30, 2013, 06:01 UTC
- Message-ID
- <CAPig+cTiSAzusYmh6YrtZH_FB3Ap8Xrg-+Od-y_Jjj84MMW1og@mail.gmail.com>
- In-Reply-To
- <1367293372-1958-2-git-send-email-pclouds@gmail.com>
On Mon, Apr 29, 2013 at 11:42 PM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
Show 20 quoted lines
> diff --git a/cache.h b/cache.h > index 94ca1ac..bed403a 100644 > --- a/cache.h > +++ b/cache.h > @@ -744,12 +744,33 @@ char *strip_path_suffix(const char *path, const char *suffix); > int daemon_avoid_alias(const char *path); > int offset_1st_component(const char *path); > > +/* > + * odb origin bit mask: > + * - 8 low bits are for requested objects > + * - 8 high bits are for their base objects > + */ > +#define ODB_LOCAL 1 > +#define ODB_ALT 2 > +#define ODB_CACHED 4 > +/* > + * This flag is used to track if the origin selection is from > + * "odb_default" below. Not a real source, not to be passed to any > + * function cals explicitly.
s/cals/calls/
Show 20 quoted lines
> + */
> +#define ODB_DEFAULT 8
> +
> +extern unsigned int odb_default;
> +
> /* object replacement */
> #define READ_SHA1_FILE_REPLACE 1
> -extern void *read_sha1_file_extended(const unsigned char *sha1, enum object_type *type, unsigned long *size, unsigned flag);
> +extern void *read_sha1_file_extended(const unsigned char *sha1,
> + unsigned int origin,
> + enum object_type *type,
> + unsigned long *size,
> + unsigned flag);
> static inline void *read_sha1_file(const unsigned char *sha1, enum object_type *type, unsigned long *size)
> {
> - return read_sha1_file_extended(sha1, type, size, READ_SHA1_FILE_REPLACE);
> + return read_sha1_file_extended(sha1, odb_default, type, size, READ_SHA1_FILE_REPLACE);
> }
> extern const unsigned char *do_lookup_replace_object(const unsigned char *sha1);
> static inline const unsigned char *lookup_replace_object(const unsigned char *sha1)