Merge branch 'bc/object-id'
"uchar [40]" to "struct object_id" conversion continues. * bc/object-id: wt-status: convert to struct object_id builtin/merge-base: convert to struct object_id Convert object iteration callbacks to struct object_id sha1_file: introduce an nth_packed_object_oid function refs: simplify parsing of reflog entries refs: convert each_reflog_ent_fn to struct object_id reflog-walk: convert struct reflog_info to struct object_id builtin/replace: convert to struct object_id Convert remaining callers of resolve_refdup to object_id builtin/merge: convert to struct object_id builtin/clone: convert to struct object_id builtin/branch: convert to struct object_id builtin/grep: convert to struct object_id builtin/fmt-merge-message: convert to struct object_id builtin/fast-export: convert to struct object_id builtin/describe: convert to struct object_id builtin/diff-tree: convert to struct object_id builtin/commit: convert to struct object_id hex: introduce parse_oid_hex
This commit is contained in:
19
cache.h
19
cache.h
@ -1363,6 +1363,15 @@ extern char *oid_to_hex_r(char *out, const struct object_id *oid);
|
||||
extern char *sha1_to_hex(const unsigned char *sha1); /* static buffer result! */
|
||||
extern char *oid_to_hex(const struct object_id *oid); /* same static buffer as sha1_to_hex */
|
||||
|
||||
/*
|
||||
* Parse a 40-character hexadecimal object ID starting from hex, updating the
|
||||
* pointer specified by end when parsing stops. The resulting object ID is
|
||||
* stored in oid. Returns 0 on success. Parsing will stop on the first NUL or
|
||||
* other invalid character. end is only updated on success; otherwise, it is
|
||||
* unmodified.
|
||||
*/
|
||||
extern int parse_oid_hex(const char *hex, struct object_id *oid, const char **end);
|
||||
|
||||
/*
|
||||
* This reads short-hand syntax that not only evaluates to a commit
|
||||
* object name, but also can act as if the end user spelled the name
|
||||
@ -1673,6 +1682,12 @@ extern void check_pack_index_ptr(const struct packed_git *p, const void *ptr);
|
||||
* error.
|
||||
*/
|
||||
extern const unsigned char *nth_packed_object_sha1(struct packed_git *, uint32_t n);
|
||||
/*
|
||||
* Like nth_packed_object_sha1, but write the data into the object specified by
|
||||
* the the first argument. Returns the first argument on success, and NULL on
|
||||
* error.
|
||||
*/
|
||||
extern const struct object_id *nth_packed_object_oid(struct object_id *, struct packed_git *, uint32_t n);
|
||||
|
||||
/*
|
||||
* Return the offset of the nth object within the specified packfile.
|
||||
@ -1714,7 +1729,7 @@ extern int unpack_object_header(struct packed_git *, struct pack_window **, off_
|
||||
* scratch buffer, but restored to its original contents before
|
||||
* the function returns.
|
||||
*/
|
||||
typedef int each_loose_object_fn(const unsigned char *sha1,
|
||||
typedef int each_loose_object_fn(const struct object_id *oid,
|
||||
const char *path,
|
||||
void *data);
|
||||
typedef int each_loose_cruft_fn(const char *basename,
|
||||
@ -1740,7 +1755,7 @@ int for_each_loose_file_in_objdir_buf(struct strbuf *path,
|
||||
* LOCAL_ONLY flag is set).
|
||||
*/
|
||||
#define FOR_EACH_OBJECT_LOCAL_ONLY 0x1
|
||||
typedef int each_packed_object_fn(const unsigned char *sha1,
|
||||
typedef int each_packed_object_fn(const struct object_id *oid,
|
||||
struct packed_git *pack,
|
||||
uint32_t pos,
|
||||
void *data);
|
||||
|
Reference in New Issue
Block a user