mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
Merge branch 'eb/hash-transition'
Work to support a repository that work with both SHA-1 and SHA-256 hash algorithms has started. * eb/hash-transition: (30 commits) t1016-compatObjectFormat: add tests to verify the conversion between objects t1006: test oid compatibility with cat-file t1006: rename sha1 to oid test-lib: compute the compatibility hash so tests may use it builtin/ls-tree: let the oid determine the output algorithm object-file: handle compat objects in check_object_signature tree-walk: init_tree_desc take an oid to get the hash algorithm builtin/cat-file: let the oid determine the output algorithm rev-parse: add an --output-object-format parameter repository: implement extensions.compatObjectFormat object-file: update object_info_extended to reencode objects object-file-convert: convert commits that embed signed tags object-file-convert: convert commit objects when writing object-file-convert: don't leak when converting tag objects object-file-convert: convert tag objects when writing object-file-convert: add a function to convert trees between algorithms object: factor out parse_mode out of fast-import and tree-walk into in object.h cache: add a function to read an OID of a specific algorithm tag: sign both hashes commit: export add_header_signature to support handling signatures on tags ...
This commit is contained in:
18
object.h
18
object.h
@@ -190,6 +190,24 @@ void *create_object(struct repository *r, const struct object_id *oid, void *obj
|
||||
|
||||
void *object_as_type(struct object *obj, enum object_type type, int quiet);
|
||||
|
||||
|
||||
static inline const char *parse_mode(const char *str, uint16_t *modep)
|
||||
{
|
||||
unsigned char c;
|
||||
unsigned int mode = 0;
|
||||
|
||||
if (*str == ' ')
|
||||
return NULL;
|
||||
|
||||
while ((c = *str++) != ' ') {
|
||||
if (c < '0' || c > '7')
|
||||
return NULL;
|
||||
mode = (mode << 3) + (c - '0');
|
||||
}
|
||||
*modep = mode;
|
||||
return str;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the object, having parsed it to find out what it is.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user