mirror of
https://github.com/git/git.git
synced 2024-05-05 10:36:11 +02:00
Merge branch 'jt/fetch-peek-optional-section' into next
"git fetch" unnecessarily failed when an unexpected optional section appeared in the output, which has been corrected. * jt/fetch-peek-optional-section: fetch-pack: make unexpected peek result non-fatal
This commit is contained in:
commit
bc876bd2cf
19
fetch-pack.c
19
fetch-pack.c
|
@ -1370,17 +1370,20 @@ static int send_fetch_request(struct fetch_negotiator *negotiator, int fd_out,
|
||||||
static int process_section_header(struct packet_reader *reader,
|
static int process_section_header(struct packet_reader *reader,
|
||||||
const char *section, int peek)
|
const char *section, int peek)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret = 0;
|
||||||
|
|
||||||
if (packet_reader_peek(reader) != PACKET_READ_NORMAL)
|
if (packet_reader_peek(reader) == PACKET_READ_NORMAL &&
|
||||||
die(_("error reading section header '%s'"), section);
|
!strcmp(reader->line, section))
|
||||||
|
ret = 1;
|
||||||
ret = !strcmp(reader->line, section);
|
|
||||||
|
|
||||||
if (!peek) {
|
if (!peek) {
|
||||||
if (!ret)
|
if (!ret) {
|
||||||
die(_("expected '%s', received '%s'"),
|
if (reader->line)
|
||||||
section, reader->line);
|
die(_("expected '%s', received '%s'"),
|
||||||
|
section, reader->line);
|
||||||
|
else
|
||||||
|
die(_("expected '%s'"), section);
|
||||||
|
}
|
||||||
packet_reader_read(reader);
|
packet_reader_read(reader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue