Raw
1 #ifndef LIB_OID_H
2 #define LIB_OID_H
3
4 #include "hash.h"
5
6 /*
7 * Convert arbitrary hex string to object_id.
8 *
9 * For example, passing "abc12" will generate
10 * "abc1200000000000000000000000000000000000" hex of length 40 for SHA-1 and
11 * create object_id with that.
12 * WARNING: passing a string of length more than the hexsz of respective hash
13 * algo is not allowed. The hash algo is decided based on GIT_TEST_DEFAULT_HASH
14 * environment variable.
15 */
16
17 void cl_parse_any_oid (const char *s, struct object_id *oid);
18 /*
19 * Returns one of GIT_HASH_{SHA1, SHA256, UNKNOWN} based on the value of
20 * GIT_TEST_DEFAULT_HASH environment variable. The fallback value in the
21 * absence of GIT_TEST_DEFAULT_HASH is GIT_HASH_SHA1. It also uses
22 * cl_assert(algo != GIT_HASH_UNKNOWN) before returning to verify if the
23 * GIT_TEST_DEFAULT_HASH's value is valid or not.
24 */
25
26 int cl_setup_hash_algo(void);
27
28 #endif /* LIB_OID_H */