[PATCH v2 1/9] bundle-uri: short-circuit capability parsing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Derrick Stolee <derrickstolee@xxxxxxxxxx>

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@xxxxxxxxx>
Signed-off-by: Derrick Stolee <derrickstolee@xxxxxxxxxx>
---
 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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux