diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-07-05 13:32:57 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-07-05 13:32:57 -0700 |
commit | 00b7cf2379901394c971db5ab59ce70e12e434b7 (patch) | |
tree | 8faa0060f04463c5ee526b5db5e0240a272bf679 /builtin | |
parent | 8e90578ffbce029a09c2a56e95ba3009f27e4937 (diff) | |
parent | e83e71c5e15f2c6aaf9bdb8ee9593a46c3bb9a5b (diff) | |
download | git-00b7cf2379901394c971db5ab59ce70e12e434b7.tar.gz |
Merge branch 'jt/unify-object-info'
Code clean-ups.
* jt/unify-object-info:
sha1_file: refactor has_sha1_file_with_flags
sha1_file: do not access pack if unneeded
sha1_file: teach sha1_object_info_extended more flags
sha1_file: refactor read_object
sha1_file: move delta base cache code up
sha1_file: rename LOOKUP_REPLACE_OBJECT
sha1_file: rename LOOKUP_UNKNOWN_OBJECT
sha1_file: teach packed_object_info about typename
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/cat-file.c | 7 | ||||
-rw-r--r-- | builtin/fetch.c | 10 | ||||
-rw-r--r-- | builtin/index-pack.c | 3 |
3 files changed, 12 insertions, 8 deletions
diff --git a/builtin/cat-file.c b/builtin/cat-file.c index 7efbc4019a..96b786e489 100644 --- a/builtin/cat-file.c +++ b/builtin/cat-file.c @@ -57,11 +57,11 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name, struct object_context obj_context; struct object_info oi = OBJECT_INFO_INIT; struct strbuf sb = STRBUF_INIT; - unsigned flags = LOOKUP_REPLACE_OBJECT; + unsigned flags = OBJECT_INFO_LOOKUP_REPLACE; const char *path = force_path; if (unknown_type) - flags |= LOOKUP_UNKNOWN_OBJECT; + flags |= OBJECT_INFO_ALLOW_UNKNOWN_TYPE; if (get_sha1_with_context(obj_name, GET_SHA1_RECORD_PATH, oid.hash, &obj_context)) @@ -338,7 +338,8 @@ static void batch_object_write(const char *obj_name, struct batch_options *opt, struct strbuf buf = STRBUF_INIT; if (!data->skip_object_info && - sha1_object_info_extended(data->oid.hash, &data->info, LOOKUP_REPLACE_OBJECT) < 0) { + sha1_object_info_extended(data->oid.hash, &data->info, + OBJECT_INFO_LOOKUP_REPLACE) < 0) { printf("%s missing\n", obj_name ? obj_name : oid_to_hex(&data->oid)); fflush(stdout); diff --git a/builtin/fetch.c b/builtin/fetch.c index 16cf8421ce..1838a9abfb 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -250,9 +250,11 @@ static void find_non_local_tags(struct transport *transport, */ if (ends_with(ref->name, "^{}")) { if (item && - !has_object_file_with_flags(&ref->old_oid, HAS_SHA1_QUICK) && + !has_object_file_with_flags(&ref->old_oid, + OBJECT_INFO_QUICK) && !will_fetch(head, ref->old_oid.hash) && - !has_sha1_file_with_flags(item->util, HAS_SHA1_QUICK) && + !has_sha1_file_with_flags(item->util, + OBJECT_INFO_QUICK) && !will_fetch(head, item->util)) item->util = NULL; item = NULL; @@ -266,7 +268,7 @@ static void find_non_local_tags(struct transport *transport, * fetch. */ if (item && - !has_sha1_file_with_flags(item->util, HAS_SHA1_QUICK) && + !has_sha1_file_with_flags(item->util, OBJECT_INFO_QUICK) && !will_fetch(head, item->util)) item->util = NULL; @@ -287,7 +289,7 @@ static void find_non_local_tags(struct transport *transport, * checked to see if it needs fetching. */ if (item && - !has_sha1_file_with_flags(item->util, HAS_SHA1_QUICK) && + !has_sha1_file_with_flags(item->util, OBJECT_INFO_QUICK) && !will_fetch(head, item->util)) item->util = NULL; diff --git a/builtin/index-pack.c b/builtin/index-pack.c index ad4de35178..26828c1d82 100644 --- a/builtin/index-pack.c +++ b/builtin/index-pack.c @@ -793,7 +793,8 @@ static void sha1_object(const void *data, struct object_entry *obj_entry, if (startup_info->have_repository) { read_lock(); - collision_test_needed = has_sha1_file_with_flags(oid->hash, HAS_SHA1_QUICK); + collision_test_needed = + has_sha1_file_with_flags(oid->hash, OBJECT_INFO_QUICK); read_unlock(); } |