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

Function process_section_header

fetch-pack.c:1497–1518  ·  view source on GitHub ↗

* Processes a section header in a server's response and checks if it matches * `section`. If the value of `peek` is 1, the header line will be peeked (and * not consumed); if 0, the line will be consumed and the function will die if * the section header doesn't match what was expected. */

Source from the content-addressed store, hash-verified

1495 * the section header doesn't match what was expected.
1496 */
1497static int process_section_header(struct packet_reader *reader,
1498 const char *section, int peek)
1499{
1500 int ret = 0;
1501
1502 if (packet_reader_peek(reader) == PACKET_READ_NORMAL &&
1503 !strcmp(reader->line, section))
1504 ret = 1;
1505
1506 if (!peek) {
1507 if (!ret) {
1508 if (reader->line)
1509 die(_("expected '%s', received '%s'"),
1510 section, reader->line);
1511 else
1512 die(_("expected '%s'"), section);
1513 }
1514 packet_reader_read(reader);
1515 }
1516
1517 return ret;
1518}
1519
1520static int process_ack(struct fetch_negotiator *negotiator,
1521 struct packet_reader *reader,

Callers 5

receive_shallow_infoFunction · 0.85
receive_wanted_refsFunction · 0.85
receive_packfile_urisFunction · 0.85
do_fetch_pack_v2Function · 0.85
negotiate_using_fetchFunction · 0.85

Calls 3

packet_reader_peekFunction · 0.85
packet_reader_readFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected