From: Junio C Hamano Date: Tue, 6 Sep 2011 18:42:12 +0000 (-0700) Subject: Sync with 1.7.6.2 X-Git-Tag: v1.7.7-rc1~10 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/48f36dcd7320d27a840e89fc2aa7ab11716951c6?hp=-c Sync with 1.7.6.2 Signed-off-by: Junio C Hamano --- 48f36dcd7320d27a840e89fc2aa7ab11716951c6 diff --combined Documentation/git-receive-pack.txt index a3a1d8eea3,459c08598f..b1f7dc643a --- a/Documentation/git-receive-pack.txt +++ b/Documentation/git-receive-pack.txt @@@ -9,7 -9,7 +9,7 @@@ git-receive-pack - Receive what is push SYNOPSIS -------- [verse] - 'git-receive-pack' [--quiet] + 'git-receive-pack' DESCRIPTION ----------- @@@ -35,9 -35,6 +35,6 @@@ are not fast-forwards OPTIONS ------- - --quiet:: - Print only error messages. - :: 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 d08a8bb4f2,167ad5e9d3..651e155d1d --- a/Documentation/git.txt +++ b/Documentation/git.txt @@@ -10,8 -10,8 +10,8 @@@ SYNOPSI -------- [verse] 'git' [--version] [--exec-path[=]] [--html-path] [--man-path] [--info-path] - [-p|--paginate|--no-pager] [--no-replace-objects] - [--bare] [--git-dir=] [--work-tree=] + [-p|--paginate|--no-pager] [--no-replace-objects] [--bare] + [--git-dir=] [--work-tree=] [--namespace=] [-c =] [--help] [] @@@ -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=:: + 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 60260d0aa9,e1a687ad07..ae164da4d5 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@@ -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; @@@ -361,10 -343,7 +361,10 @@@ 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; @@@ -392,7 -371,7 +392,7 @@@ return "deletion prohibited"; } - if (!strcmp(name, head_name)) { + if (!strcmp(namespaced_name, head_name)) { switch (deny_delete_current) { case DENY_IGNORE: break; @@@ -448,14 -427,14 +448,14 @@@ 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; @@@ -684,10 -651,8 +684,8 @@@ 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; @@@ -802,11 -766,6 +799,6 @@@ const char *arg = *argv++; if (*arg == '-') { - if (!strcmp(arg, "--quiet")) { - quiet = 1; - continue; - } - if (!strcmp(arg, "--advertise-refs")) { advertise_refs = 1; continue; @@@ -855,7 -814,7 +847,7 @@@ 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 5798aa57b6,69831e931a..b8cf45a7dd --- a/remote-curl.c +++ b/remote-curl.c @@@ -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) @@@ -904,7 -895,6 +902,7 @@@ printf("\n"); fflush(stdout); } else { + fprintf(stderr, "Unknown command '%s'\n", buf.buf); return 1; } strbuf_reset(&buf); diff --combined transport.c index d2725e57dc,c9c8056f9d..fa279d531f --- a/transport.c +++ b/transport.c @@@ -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;