MCPcopy Create free account
hub / github.com/git/git / read_refs_snapshot

Function read_refs_snapshot

midx-write.c:803–836  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

801}
802
803static int read_refs_snapshot(const char *refs_snapshot,
804 struct rev_info *revs)
805{
806 struct strbuf buf = STRBUF_INIT;
807 struct object_id oid;
808 FILE *f = xfopen(refs_snapshot, "r");
809
810 while (strbuf_getline(&buf, f) != EOF) {
811 struct object *object;
812 int preferred = 0;
813 char *hex = buf.buf;
814 const char *end = NULL;
815
816 if (buf.len && *buf.buf == '+') {
817 preferred = 1;
818 hex = &buf.buf[1];
819 }
820
821 if (parse_oid_hex_algop(hex, &oid, &end, revs->repo->hash_algo) < 0)
822 die(_("could not parse line: %s"), buf.buf);
823 if (*end)
824 die(_("malformed line: %s"), buf.buf);
825
826 object = parse_object_or_die(revs->repo, &oid, NULL);
827 if (preferred)
828 object->flags |= NEEDS_BITMAP;
829
830 add_pending_object(revs, object, "");
831 }
832
833 fclose(f);
834 strbuf_release(&buf);
835 return 0;
836}
837
838static void find_commits_for_midx_bitmap(struct commit_stack *commits,
839 const char *refs_snapshot,

Callers 1

Calls 6

xfopenFunction · 0.85
strbuf_getlineFunction · 0.85
parse_object_or_dieFunction · 0.85
add_pending_objectFunction · 0.85
strbuf_releaseFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected