]> granicus.if.org Git - git/commitdiff
connect: use strcmp() for string comparison
authorRené Scharfe <l.s.r@web.de>
Sat, 21 Feb 2015 19:49:58 +0000 (20:49 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sun, 22 Feb 2015 20:01:37 +0000 (12:01 -0800)
Get rid of magic string length constants and simply compare the strings
using strcmp().  This makes the intent of the code a bit clearer.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
connect.c

index 5047402a1aade7a443f55999550ae4542189ef01..5bff3ed3f2eef1d1caf16e919ffb07fc0461d267 100644 (file)
--- a/connect.c
+++ b/connect.c
@@ -161,8 +161,7 @@ struct ref **get_remote_heads(int in, char *src_buf, size_t src_len,
                        server_capabilities = xstrdup(name + name_len + 1);
                }
 
-               if (extra_have &&
-                   name_len == 5 && !memcmp(".have", name, 5)) {
+               if (extra_have && !strcmp(name, ".have")) {
                        sha1_array_append(extra_have, old_sha1);
                        continue;
                }