Merge branch 'nd/indent-fix-connect-c'
authorJunio C Hamano <gitster@pobox.com>
Tue, 25 Mar 2014 18:07:05 +0000 (11:07 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 25 Mar 2014 18:07:06 +0000 (11:07 -0700)
* nd/indent-fix-connect-c:
connect.c: SP after "}", not TAB

1  2 
connect.c
diff --combined connect.c
index 4150412e2c0ebf6129137baf41c9d268d50c60bd,3140c12d3cf3f0a34e2830f0192463f00a815014..a983d061a90f0b720afa1a9b50247da299164d79
+++ b/connect.c
@@@ -8,7 -8,6 +8,7 @@@
  #include "connect.h"
  #include "url.h"
  #include "string-list.h"
 +#include "sha1-array.h"
  
  static char *server_capabilities;
  static const char *parse_feature_value(const char *, const char *, int *);
@@@ -46,6 -45,13 +46,6 @@@ int check_ref_type(const struct ref *re
        return check_ref(ref->name, strlen(ref->name), flags);
  }
  
 -static void add_extra_have(struct extra_have_objects *extra, unsigned char *sha1)
 -{
 -      ALLOC_GROW(extra->array, extra->nr + 1, extra->alloc);
 -      hashcpy(&(extra->array[extra->nr][0]), sha1);
 -      extra->nr++;
 -}
 -
  static void die_initial_contact(int got_at_least_one_head)
  {
        if (got_at_least_one_head)
@@@ -116,8 -122,7 +116,8 @@@ static void annotate_refs_with_symref_i
   */
  struct ref **get_remote_heads(int in, char *src_buf, size_t src_len,
                              struct ref **list, unsigned int flags,
 -                            struct extra_have_objects *extra_have)
 +                            struct sha1_array *extra_have,
 +                            struct sha1_array *shallow_points)
  {
        struct ref **orig_list = list;
        int got_at_least_one_head = 0;
                if (!len)
                        break;
  
 -              if (len > 4 && !prefixcmp(buffer, "ERR "))
 +              if (len > 4 && starts_with(buffer, "ERR "))
                        die("remote error: %s", buffer + 4);
  
 +              if (len == 48 && starts_with(buffer, "shallow ")) {
 +                      if (get_sha1_hex(buffer + 8, old_sha1))
 +                              die("protocol error: expected shallow sha-1, got '%s'", buffer + 8);
 +                      if (!shallow_points)
 +                              die("repository on the other end cannot be shallow");
 +                      sha1_array_append(shallow_points, old_sha1);
 +                      continue;
 +              }
 +
                if (len < 42 || get_sha1_hex(buffer, old_sha1) || buffer[40] != ' ')
                        die("protocol error: expected sha/ref, got '%s'", buffer);
                name = buffer + 41;
  
                if (extra_have &&
                    name_len == 5 && !memcmp(".have", name, 5)) {
 -                      add_extra_have(extra_have, old_sha1);
 +                      sha1_array_append(extra_have, old_sha1);
                        continue;
                }
  
@@@ -727,7 -723,7 +727,7 @@@ struct child_process *git_connect(int f
                                *arg++ = port;
                        }
                        *arg++ = ssh_host;
-               }       else {
+               } else {
                        /* remove repo-local variables from the environment */
                        conn->env = local_repo_env;
                        conn->use_shell = 1;