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

Function read_object_list_from_stdin

builtin/pack-objects.c:4359–4389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4357}
4358
4359static void read_object_list_from_stdin(void)
4360{
4361 char line[GIT_MAX_HEXSZ + 1 + PATH_MAX + 2];
4362 struct object_id oid;
4363 const char *p;
4364
4365 for (;;) {
4366 if (!fgets(line, sizeof(line), stdin)) {
4367 if (feof(stdin))
4368 break;
4369 if (!ferror(stdin))
4370 BUG("fgets returned NULL, not EOF, not error!");
4371 if (errno != EINTR)
4372 die_errno("fgets");
4373 clearerr(stdin);
4374 continue;
4375 }
4376 if (line[0] == '-') {
4377 if (get_oid_hex(line+1, &oid))
4378 die(_("expected edge object ID, got garbage:\n %s"),
4379 line);
4380 add_preferred_base(&oid);
4381 continue;
4382 }
4383 if (parse_oid_hex(line, &oid, &p))
4384 die(_("expected object ID, got garbage:\n %s"), line);
4385
4386 add_preferred_base_object(p + 1);
4387 add_object_entry(&oid, OBJ_NONE, p + 1, 0);
4388 }
4389}
4390
4391static void show_commit(struct commit *commit, void *data UNUSED)
4392{

Callers 1

cmd_pack_objectsFunction · 0.85

Calls 7

die_errnoFunction · 0.85
get_oid_hexFunction · 0.85
add_preferred_baseFunction · 0.85
parse_oid_hexFunction · 0.85
add_object_entryFunction · 0.85
dieFunction · 0.50

Tested by

no test coverage detected