[PATCH v2 1/9] bundle-uri: short-circuit capability parsing
- From
Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Sep 9, 2022, 14:33 UTC
- Message-ID
- <2ca431e6c377f42d70ea9ce0ac74058fc983ea2c.1662734015.git.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.1333.v2.git.1662734015.gitgitgadget@gmail.com>
From: Derrick Stolee <derrickstolee@github.com>
When parsing the capability lines from the 'git remote-https' process, we can stop reading the lines once we notice the 'get' capability.
Reported-by: Teng Long <dyroneteng@gmail.com> Signed-off-by: Derrick Stolee <derrickstolee@github.com> --- bundle-uri.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/bundle-uri.c b/bundle-uri.c index 4a8cc74ed05..7173ed065e9 100644 --- a/bundle-uri.c +++ b/bundle-uri.c @@ -56,8 +56,10 @@ static int download_https_uri_to_file(const char *file, const char *uri) while (!strbuf_getline(&line, child_out)) { if (!line.len) break; - if (!strcmp(line.buf, "get")) + if (!strcmp(line.buf, "get")) { found_get = 1; + break; + } } strbuf_release(&line);
-- gitgitgadget