diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-03-17 21:50:24 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-03-17 21:50:25 +0100 |
commit | e1fae930193b3e8ff02cee936605625f63e1d1e4 (patch) | |
tree | 90ad9f3e50d1f1d6acd174ecb4dc0a8bbc28df27 /cache.h | |
parent | Merge branch 'rs/blame-code-cleanup' (diff) | |
parent | wt-status: convert to struct object_id (diff) | |
download | git-e1fae930193b3e8ff02cee936605625f63e1d1e4.tar.xz git-e1fae930193b3e8ff02cee936605625f63e1d1e4.zip |
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
Diffstat (limited to 'cache.h')
-rw-r--r-- | cache.h | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -1364,6 +1364,15 @@ 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 * of the branch from the command line. @@ -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); |