MCPcopy Index your code
hub / github.com/git/git / odb_count_objects

Function odb_count_objects

odb.c:870–903  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

868}
869
870int odb_count_objects(struct object_database *odb,
871 enum odb_count_objects_flags flags,
872 unsigned long *out)
873{
874 struct odb_source *source;
875 unsigned long count = 0;
876 int ret;
877
878 if (odb->object_count_valid && odb->object_count_flags == flags) {
879 *out = odb->object_count;
880 return 0;
881 }
882
883 odb_prepare_alternates(odb);
884 for (source = odb->sources; source; source = source->next) {
885 unsigned long c;
886
887 ret = odb_source_count_objects(source, flags, &c);
888 if (ret < 0)
889 goto out;
890
891 count += c;
892 }
893
894 odb->object_count = count;
895 odb->object_count_valid = 1;
896 odb->object_count_flags = flags;
897
898 *out = count;
899 ret = 0;
900
901out:
902 return ret;
903}
904
905/*
906 * Return the slot of the most-significant bit set in "val". There are various

Callers 3

write_commit_graphFunction · 0.85
odb_find_abbrev_lenFunction · 0.85
estimate_repack_memoryFunction · 0.85

Calls 2

odb_prepare_alternatesFunction · 0.85
odb_source_count_objectsFunction · 0.85

Tested by

no test coverage detected