@matheusbsbs / matheus-bagliano / commits / cf01bd52ef
Fork 0

We should make sure that the protocol is still extensible.

This just reformats if .. else if .. else chain to make it clear we are handling extended response from the other end.

Junio C Hamano committed Nov 13, 2006 at 22:04 UTC cf01bd52efeb21084652b2b06b778ed458004e8f
1 file changed +7 -4
fetch-pack.c
+7 -4
@@ -189,7 +189,7 @@ static int find_common(int fd[2], unsigned char *result_sha1,
189 if (!fetching)
190 return 1;
191
192 - if (depth > 0) {
192 + if (depth > 0) {
193 char line[1024];
194 unsigned char sha1[20];
195 int len;
@@ -202,7 +202,9 @@ static int find_common(int fd[2], unsigned char *result_sha1,
202 if (lookup_object(sha1))
203 continue;
204 register_shallow(sha1);
205 - } else if (!strncmp("unshallow ", line, 10)) {
205 + continue;
206 + }
207 + if (!strncmp("unshallow ", line, 10)) {
208 if (get_sha1_hex(line + 10, sha1))
209 die("invalid unshallow line: %s", line);
210 if (!lookup_object(sha1))
@@ -211,8 +213,9 @@ static int find_common(int fd[2], unsigned char *result_sha1,
213 parse_object(sha1);
214 if (unregister_shallow(sha1))
215 die("no shallow found: %s", line);
214 - } else
215 - die("expected shallow/unshallow, got %s", line);
216 + continue;
217 + }
218 + die("expected shallow/unshallow, got %s", line);
219 }
220 }
221