summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Jonathan Tan <jonathantanmy@google.com>2017-06-21 17:40:24 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-06-26 10:28:58 -0700
commite83e71c5e15f2c6aaf9bdb8ee9593a46c3bb9a5b (patch)
tree933f4dd4f8205411367bc2f24208a1a632fd2267 /builtin
parentsha1_file: do not access pack if unneeded (diff)
downloadtgif-e83e71c5e15f2c6aaf9bdb8ee9593a46c3bb9a5b.tar.xz
sha1_file: refactor has_sha1_file_with_flags
has_sha1_file_with_flags() implements many mechanisms in common with sha1_object_info_extended(). Make has_sha1_file_with_flags() a convenience function for sha1_object_info_extended() instead. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/fetch.c10
-rw-r--r--builtin/index-pack.c3
2 files changed, 8 insertions, 5 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 100248c5af..4c8d055d6e 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -249,9 +249,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;
@@ -265,7 +267,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;
@@ -286,7 +288,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 04b9dcaf0f..587bc80c96 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -794,7 +794,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();
}