Sync with 1.7.6.2
authorJunio C Hamano <gitster@pobox.com>
Tue, 6 Sep 2011 18:42:12 +0000 (11:42 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 6 Sep 2011 18:42:12 +0000 (11:42 -0700)
Signed-off-by: Junio C Hamano <gitster@pobox.com>
1  2 
Documentation/git-receive-pack.txt
Documentation/git.txt
builtin/receive-pack.c
remote-curl.c
transport.c
index a3a1d8eea3ec733d155475f2d6216e1e71245f10,459c08598f31fccf1b5db31f2f1cd9680654b389..b1f7dc643a0e9b6b232e1c75b39d7f784ab21b4a
@@@ -9,7 -9,7 +9,7 @@@ git-receive-pack - Receive what is push
  SYNOPSIS
  --------
  [verse]
- 'git-receive-pack' [--quiet] <directory>
+ 'git-receive-pack' <directory>
  
  DESCRIPTION
  -----------
@@@ -35,9 -35,6 +35,6 @@@ are not fast-forwards
  
  OPTIONS
  -------
- --quiet::
-       Print only error messages.
  <directory>::
        The repository to sync into.
  
@@@ -153,7 -150,7 +150,7 @@@ if the repository is packed and is serv
  
  SEE ALSO
  --------
 -linkgit:git-send-pack[1]
 +linkgit:git-send-pack[1], linkgit:gitnamespaces[7]
  
  GIT
  ---
diff --combined Documentation/git.txt
index d08a8bb4f2bcf106f925346b274740cd7a136de9,167ad5e9d3f7e7fa0dfe508dbddc9ad91ba10b7d..651e155d1de0dc7251e6592e867141d9ce841723
@@@ -10,8 -10,8 +10,8 @@@ SYNOPSI
  --------
  [verse]
  'git' [--version] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
 -    [-p|--paginate|--no-pager] [--no-replace-objects]
 -    [--bare] [--git-dir=<path>] [--work-tree=<path>]
 +    [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
 +    [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
      [-c <name>=<value>]
      [--help] <command> [<args>]
  
@@@ -44,10 -44,11 +44,11 @@@ unreleased) version of git, that is ava
  branch of the `git.git` repository.
  Documentation for older releases are available here:
  
- * link:v1.7.6.1/git.html[documentation for release 1.7.6.1]
+ * link:v1.7.6.2/git.html[documentation for release 1.7.6.2]
  
  * release notes for
-   link:RelNotes/1.7.6.1.txt[1.7.6.1].
+   link:RelNotes/1.7.6.2.txt[1.7.6.2],
+   link:RelNotes/1.7.6.1.txt[1.7.6.1],
    link:RelNotes/1.7.6.txt[1.7.6].
  
  * link:v1.7.5.4/git.html[documentation for release 1.7.5.4]
@@@ -331,11 -332,6 +332,11 @@@ help ...`
        variable (see core.worktree in linkgit:git-config[1] for a
        more detailed discussion).
  
 +--namespace=<path>::
 +      Set the git namespace.  See linkgit:gitnamespaces[7] for more
 +      details.  Equivalent to setting the `GIT_NAMESPACE` environment
 +      variable.
 +
  --bare::
        Treat the repository as a bare repository.  If GIT_DIR
        environment is not set, it is set to the current working
@@@ -599,10 -595,6 +600,10 @@@ git so take care if using Cogito etc
        This can also be controlled by the '--work-tree' command line
        option and the core.worktree configuration variable.
  
 +'GIT_NAMESPACE'::
 +      Set the git namespace; see linkgit:gitnamespaces[7] for details.
 +      The '--namespace' command-line option also sets this value.
 +
  'GIT_CEILING_DIRECTORIES'::
        This should be a colon-separated list of absolute paths.
        If set, it is a list of directories that git should not chdir
diff --combined builtin/receive-pack.c
index 60260d0aa93a878968e5ed72a2a77b96c5c0f040,e1a687ad0761e46f6ec95659bb585b9014d4abf4..ae164da4d5a7b7a2c87937ba0983126586f1e646
@@@ -120,25 -120,9 +120,25 @@@ static int show_ref(const char *path, c
        return 0;
  }
  
 +static int show_ref_cb(const char *path, const unsigned char *sha1, int flag, void *cb_data)
 +{
 +      path = strip_namespace(path);
 +      /*
 +       * Advertise refs outside our current namespace as ".have"
 +       * refs, so that the client can use them to minimize data
 +       * transfer but will otherwise ignore them. This happens to
 +       * cover ".have" that are thrown in by add_one_alternate_ref()
 +       * to mark histories that are complete in our alternates as
 +       * well.
 +       */
 +      if (!path)
 +              path = ".have";
 +      return show_ref(path, sha1, flag, cb_data);
 +}
 +
  static void write_head_info(void)
  {
 -      for_each_ref(show_ref, NULL);
 +      for_each_ref(show_ref_cb, NULL);
        if (!sent_capabilities)
                show_ref("capabilities^{}", null_sha1, 0, NULL);
  
@@@ -349,8 -333,6 +349,8 @@@ static void refuse_unconfigured_deny_de
  static const char *update(struct command *cmd)
  {
        const char *name = cmd->ref_name;
 +      struct strbuf namespaced_name_buf = STRBUF_INIT;
 +      const char *namespaced_name;
        unsigned char *old_sha1 = cmd->old_sha1;
        unsigned char *new_sha1 = cmd->new_sha1;
        struct ref_lock *lock;
                return "funny refname";
        }
  
 -      if (is_ref_checked_out(name)) {
 +      strbuf_addf(&namespaced_name_buf, "%s%s", get_git_namespace(), name);
 +      namespaced_name = strbuf_detach(&namespaced_name_buf, NULL);
 +
 +      if (is_ref_checked_out(namespaced_name)) {
                switch (deny_current_branch) {
                case DENY_IGNORE:
                        break;
                        return "deletion prohibited";
                }
  
 -              if (!strcmp(name, head_name)) {
 +              if (!strcmp(namespaced_name, head_name)) {
                        switch (deny_delete_current) {
                        case DENY_IGNORE:
                                break;
                        rp_warning("Allowing deletion of corrupt ref.");
                        old_sha1 = NULL;
                }
 -              if (delete_ref(name, old_sha1, 0)) {
 +              if (delete_ref(namespaced_name, old_sha1, 0)) {
                        rp_error("failed to delete %s", name);
                        return "failed to delete";
                }
                return NULL; /* good */
        }
        else {
 -              lock = lock_any_ref_for_update(name, old_sha1, 0);
 +              lock = lock_any_ref_for_update(namespaced_name, old_sha1, 0);
                if (!lock) {
                        rp_error("failed to lock %s", name);
                        return "failed to lock";
@@@ -512,29 -491,17 +512,29 @@@ static void run_update_post_hook(struc
  
  static void check_aliased_update(struct command *cmd, struct string_list *list)
  {
 +      struct strbuf buf = STRBUF_INIT;
 +      const char *dst_name;
        struct string_list_item *item;
        struct command *dst_cmd;
        unsigned char sha1[20];
        char cmd_oldh[41], cmd_newh[41], dst_oldh[41], dst_newh[41];
        int flag;
  
 -      const char *dst_name = resolve_ref(cmd->ref_name, sha1, 0, &flag);
 +      strbuf_addf(&buf, "%s%s", get_git_namespace(), cmd->ref_name);
 +      dst_name = resolve_ref(buf.buf, sha1, 0, &flag);
 +      strbuf_release(&buf);
  
        if (!(flag & REF_ISSYMREF))
                return;
  
 +      dst_name = strip_namespace(dst_name);
 +      if (!dst_name) {
 +              rp_error("refusing update to broken symref '%s'", cmd->ref_name);
 +              cmd->skip_update = 1;
 +              cmd->error_string = "broken symref";
 +              return;
 +      }
 +
        if ((item = string_list_lookup(list, dst_name)) == NULL)
                return;
  
@@@ -669,7 -636,7 +669,7 @@@ static const char *parse_pack_header(st
  
  static const char *pack_lockfile;
  
- static const char *unpack(int quiet)
+ static const char *unpack(void)
  {
        struct pack_header hdr;
        const char *hdr_err;
  
        if (ntohl(hdr.hdr_entries) < unpack_limit) {
                int code, i = 0;
-               const char *unpacker[5];
+               const char *unpacker[4];
                unpacker[i++] = "unpack-objects";
-               if (quiet)
-                       unpacker[i++] = "-q";
                if (receive_fsck_objects)
                        unpacker[i++] = "--strict";
                unpacker[i++] = hdr_arg;
@@@ -788,7 -753,6 +786,6 @@@ static void add_alternate_refs(void
  
  int cmd_receive_pack(int argc, const char **argv, const char *prefix)
  {
-       int quiet = 0;
        int advertise_refs = 0;
        int stateless_rpc = 0;
        int i;
                const char *arg = *argv++;
  
                if (*arg == '-') {
-                       if (!strcmp(arg, "--quiet")) {
-                               quiet = 1;
-                               continue;
-                       }
                        if (!strcmp(arg, "--advertise-refs")) {
                                advertise_refs = 1;
                                continue;
                const char *unpack_status = NULL;
  
                if (!delete_only(commands))
-                       unpack_status = unpack(quiet);
+                       unpack_status = unpack();
                execute_commands(commands, unpack_status);
                if (pack_lockfile)
                        unlink_or_warn(pack_lockfile);
diff --combined remote-curl.c
index 5798aa57b6bf7f47f4fd9c8b943602faaeee4b95,69831e931af1fe2a3e668239e8c4bb73a7bfb936..b8cf45a7dd439b83c80bcf7a397e1b8e34c70f67
@@@ -762,9 -762,7 +762,7 @@@ static int push_git(struct discovery *h
                argv[argc++] = "--thin";
        if (options.dry_run)
                argv[argc++] = "--dry-run";
-       if (options.verbosity < 0)
-               argv[argc++] = "--quiet";
-       else if (options.verbosity > 1)
+       if (options.verbosity > 1)
                argv[argc++] = "--verbose";
        argv[argc++] = url;
        for (i = 0; i < nr_spec; i++)
@@@ -857,14 -855,7 +855,14 @@@ int main(int argc, const char **argv
        http_init(remote);
  
        do {
 -              if (strbuf_getline(&buf, stdin, '\n') == EOF)
 +              if (strbuf_getline(&buf, stdin, '\n') == EOF) {
 +                      if (ferror(stdin))
 +                              fprintf(stderr, "Error reading command stream\n");
 +                      else
 +                              fprintf(stderr, "Unexpected end of command stream\n");
 +                      return 1;
 +              }
 +              if (buf.len == 0)
                        break;
                if (!prefixcmp(buf.buf, "fetch ")) {
                        if (nongit)
                        printf("\n");
                        fflush(stdout);
                } else {
 +                      fprintf(stderr, "Unknown command '%s'\n", buf.buf);
                        return 1;
                }
                strbuf_reset(&buf);
diff --combined transport.c
index d2725e57dcee993b6d969f039179406a863c94b2,c9c8056f9de69bd378cd271d70363b5560f13e07..fa279d531fe1b99841424080487e685fbe04e5bb
@@@ -10,7 -10,6 +10,7 @@@
  #include "refs.h"
  #include "branch.h"
  #include "url.h"
 +#include "submodule.h"
  
  /* rsync support */
  
@@@ -483,18 -482,14 +483,14 @@@ static int set_git_option(struct git_tr
  static int connect_setup(struct transport *transport, int for_push, int verbose)
  {
        struct git_transport_data *data = transport->data;
-       struct strbuf sb = STRBUF_INIT;
  
        if (data->conn)
                return 0;
  
-       strbuf_addstr(&sb, for_push ? data->options.receivepack :
-                                data->options.uploadpack);
-       if (for_push && transport->verbose < 0)
-               strbuf_addstr(&sb, " --quiet");
-       data->conn = git_connect(data->fd, transport->url, sb.buf,
+       data->conn = git_connect(data->fd, transport->url,
+                                for_push ? data->options.receivepack :
+                                data->options.uploadpack,
                                 verbose ? CONNECT_VERBOSE : 0);
-       strbuf_release(&sb);
  
        return 0;
  }
@@@ -1046,14 -1041,6 +1042,14 @@@ int transport_push(struct transport *tr
                        flags & TRANSPORT_PUSH_MIRROR,
                        flags & TRANSPORT_PUSH_FORCE);
  
 +              if ((flags & TRANSPORT_RECURSE_SUBMODULES_CHECK) && !is_bare_repository()) {
 +                      struct ref *ref = remote_refs;
 +                      for (; ref; ref = ref->next)
 +                              if (!is_null_sha1(ref->new_sha1) &&
 +                                  check_submodule_needs_pushing(ref->new_sha1,transport->remote->name))
 +                                      die("There are unpushed submodules, aborting.");
 +              }
 +
                push_ret = transport->push_refs(transport, remote_refs, flags);
                err = push_had_errors(remote_refs);
                ret = push_ret | err;