From: Junio C Hamano Date: Thu, 18 Aug 2011 00:26:05 +0000 (-0700) Subject: Merge branch 'cb/maint-quiet-push' X-Git-Tag: v1.7.7-rc0~29 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/6dd5622f68157f471c4f784e8c41f39e8c5163fc?hp=-c Merge branch 'cb/maint-quiet-push' * cb/maint-quiet-push: receive-pack: do not overstep command line argument array propagate --quiet to send-pack/receive-pack Conflicts: Documentation/git-receive-pack.txt Documentation/git-send-pack.txt --- 6dd5622f68157f471c4f784e8c41f39e8c5163fc diff --combined Documentation/git-receive-pack.txt index 459c08598f,23f9a48dd4..d7b68afbc2 --- a/Documentation/git-receive-pack.txt +++ b/Documentation/git-receive-pack.txt @@@ -8,8 -8,7 +8,8 @@@ git-receive-pack - Receive what is push SYNOPSIS -------- +[verse] - 'git-receive-pack' + 'git-receive-pack' [--quiet] DESCRIPTION ----------- @@@ -35,6 -34,9 +35,9 @@@ are not fast-forwards OPTIONS ------- + --quiet:: + Print only error messages. + :: The repository to sync into. diff --combined Documentation/git-send-pack.txt index bd3eaa69bf,67bcd0c568..bed9e1f097 --- a/Documentation/git-send-pack.txt +++ b/Documentation/git-send-pack.txt @@@ -8,8 -8,7 +8,8 @@@ git-send-pack - Push objects over git p SYNOPSIS -------- +[verse] - 'git send-pack' [--all] [--dry-run] [--force] [--receive-pack=] [--verbose] [--thin] [:] [...] + 'git send-pack' [--all] [--dry-run] [--force] [--receive-pack=] [--quiet] [--verbose] [--thin] [:] [...] DESCRIPTION ----------- @@@ -45,6 -44,9 +45,9 @@@ OPTION the remote repository can lose commits; use it with care. + --quiet:: + Print only error messages. + --verbose:: Run verbosely. diff --combined remote-curl.c index b8cf45a7dd,0393ab92b6..5798aa57b6 --- a/remote-curl.c +++ b/remote-curl.c @@@ -473,12 -473,16 +473,12 @@@ static int post_rpc(struct rpc_state *r * the transfer time. */ size_t size; - z_stream stream; + git_zstream stream; int ret; memset(&stream, 0, sizeof(stream)); - ret = deflateInit2(&stream, Z_BEST_COMPRESSION, - Z_DEFLATED, (15 + 16), - 8, Z_DEFAULT_STRATEGY); - if (ret != Z_OK) - die("cannot deflate request; zlib init error %d", ret); - size = deflateBound(&stream, rpc->len); + git_deflate_init_gzip(&stream, Z_BEST_COMPRESSION); + size = git_deflate_bound(&stream, rpc->len); gzip_body = xmalloc(size); stream.next_in = (unsigned char *)rpc->buf; @@@ -486,11 -490,11 +486,11 @@@ stream.next_out = (unsigned char *)gzip_body; stream.avail_out = size; - ret = deflate(&stream, Z_FINISH); + ret = git_deflate(&stream, Z_FINISH); if (ret != Z_STREAM_END) die("cannot deflate request; zlib deflate error %d", ret); - ret = deflateEnd(&stream); + ret = git_deflate_end_gently(&stream); if (ret != Z_OK) die("cannot deflate request; zlib end error %d", ret); @@@ -762,7 -766,9 +762,9 @@@ static int push_git(struct discovery *h argv[argc++] = "--thin"; if (options.dry_run) argv[argc++] = "--dry-run"; - if (options.verbosity > 1) + if (options.verbosity < 0) + argv[argc++] = "--quiet"; + else if (options.verbosity > 1) argv[argc++] = "--verbose"; argv[argc++] = url; for (i = 0; i < nr_spec; i++) @@@ -855,14 -861,7 +857,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) @@@ -902,7 -901,6 +904,7 @@@ printf("\n"); fflush(stdout); } else { + fprintf(stderr, "Unknown command '%s'\n", buf.buf); return 1; } strbuf_reset(&buf);