Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-05-26 02:42:48 +0300
committerJunio C Hamano <gitster@pobox.com>2022-05-26 02:42:48 +0300
commit9cf4e0c8d259ec822b0e017a1739e75494f5623d (patch)
tree8f98bb333cdc9c3c5715d59e71279b55c1b45dd0 /fetch-pack.c
parent18254f14f26845c8a2bc7ca7d934855068eb3257 (diff)
parent7709acf7beca41be2e382eb0e6c13b5003a20c1a (diff)
Merge branch 'jt/fetch-peek-optional-section'
"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
Diffstat (limited to 'fetch-pack.c')
-rw-r--r--fetch-pack.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/fetch-pack.c b/fetch-pack.c
index 4e1e88eea0..6d0d271259 100644
--- a/fetch-pack.c
+++ b/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,
const char *section, int peek)
{
- int ret;
-
- if (packet_reader_peek(reader) != PACKET_READ_NORMAL)
- die(_("error reading section header '%s'"), section);
+ int ret = 0;
- ret = !strcmp(reader->line, section);
+ if (packet_reader_peek(reader) == PACKET_READ_NORMAL &&
+ !strcmp(reader->line, section))
+ ret = 1;
if (!peek) {
- if (!ret)
- die(_("expected '%s', received '%s'"),
- section, reader->line);
+ if (!ret) {
+ if (reader->line)
+ die(_("expected '%s', received '%s'"),
+ section, reader->line);
+ else
+ die(_("expected '%s'"), section);
+ }
packet_reader_read(reader);
}