зеркало из https://github.com/microsoft/git.git
cache: remove null_sha1
All of the existing uses of null_sha1 can be converted into uses of null_oid, so do so. Remove null_sha1 and is_null_sha1, and define is_null_oid in terms of null_oid. This also has the additional benefit of removing several uses of sha1_to_hex. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
f6ca67d673
Коммит
8d4d86b0f0
|
@ -785,7 +785,7 @@ static int checkout(int submodule_progress)
|
|||
if (write_locked_index(&the_index, &lock_file, COMMIT_LOCK))
|
||||
die(_("unable to write new index file"));
|
||||
|
||||
err |= run_hook_le(NULL, "post-checkout", sha1_to_hex(null_sha1),
|
||||
err |= run_hook_le(NULL, "post-checkout", oid_to_hex(&null_oid),
|
||||
oid_to_hex(&oid), "1", NULL);
|
||||
|
||||
if (!err && (option_recurse_submodules.nr > 0)) {
|
||||
|
|
|
@ -424,7 +424,7 @@ static int module_list(int argc, const char **argv, const char *prefix)
|
|||
const struct cache_entry *ce = list.entries[i];
|
||||
|
||||
if (ce_stage(ce))
|
||||
printf("%06o %s U\t", ce->ce_mode, sha1_to_hex(null_sha1));
|
||||
printf("%06o %s U\t", ce->ce_mode, oid_to_hex(&null_oid));
|
||||
else
|
||||
printf("%06o %s %d\t", ce->ce_mode,
|
||||
oid_to_hex(&ce->oid), ce_stage(ce));
|
||||
|
|
8
cache.h
8
cache.h
|
@ -1029,7 +1029,6 @@ const char *repo_find_unique_abbrev(struct repository *r, const struct object_id
|
|||
int repo_find_unique_abbrev_r(struct repository *r, char *hex, const struct object_id *oid, int len);
|
||||
#define find_unique_abbrev_r(hex, oid, len) repo_find_unique_abbrev_r(the_repository, hex, oid, len)
|
||||
|
||||
extern const unsigned char null_sha1[GIT_MAX_RAWSZ];
|
||||
extern const struct object_id null_oid;
|
||||
|
||||
static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2)
|
||||
|
@ -1064,14 +1063,9 @@ static inline int oideq(const struct object_id *oid1, const struct object_id *oi
|
|||
return hasheq(oid1->hash, oid2->hash);
|
||||
}
|
||||
|
||||
static inline int is_null_sha1(const unsigned char *sha1)
|
||||
{
|
||||
return hasheq(sha1, null_sha1);
|
||||
}
|
||||
|
||||
static inline int is_null_oid(const struct object_id *oid)
|
||||
{
|
||||
return hasheq(oid->hash, null_sha1);
|
||||
return oideq(oid, &null_oid);
|
||||
}
|
||||
|
||||
static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src)
|
||||
|
|
|
@ -55,7 +55,6 @@
|
|||
"\x6f\xe1\x41\xf7\x74\x91\x20\xa3\x03\x72" \
|
||||
"\x18\x13"
|
||||
|
||||
const unsigned char null_sha1[GIT_MAX_RAWSZ];
|
||||
const struct object_id null_oid;
|
||||
static const struct object_id empty_tree_oid = {
|
||||
EMPTY_TREE_SHA1_BIN_LITERAL
|
||||
|
|
Загрузка…
Ссылка в новой задаче