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>
This commit is contained in:
Jonathan Tan
2017-06-21 17:40:24 -07:00
committed by Junio C Hamano
parent cd585e2a33
commit e83e71c5e1
4 changed files with 13 additions and 23 deletions

View File

@ -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;