Merge branch 'cb/maint-quiet-push'
authorJunio C Hamano <gitster@pobox.com>
Thu, 18 Aug 2011 00:26:05 +0000 (17:26 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 18 Aug 2011 00:26:05 +0000 (17:26 -0700)
* 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

1  2 
Documentation/git-receive-pack.txt
Documentation/git-send-pack.txt
remote-curl.c
index 459c08598f31fccf1b5db31f2f1cd9680654b389,23f9a48dd495cd125d4278fc1de5666fe5ca8777..d7b68afbc208c0bd067b4073cff75644888b5ea9
@@@ -8,8 -8,7 +8,8 @@@ git-receive-pack - Receive what is push
  
  SYNOPSIS
  --------
- 'git-receive-pack' <directory>
 +[verse]
+ 'git-receive-pack' [--quiet] <directory>
  
  DESCRIPTION
  -----------
@@@ -35,6 -34,9 +35,9 @@@ are not fast-forwards
  
  OPTIONS
  -------
+ --quiet::
+       Print only error messages.
  <directory>::
        The repository to sync into.
  
index bd3eaa69bfb6e788d297b3e7d2c871d25a478f80,67bcd0c568832d7b81ba8f57e0d8e55135cec1d0..bed9e1f097d3aa144a62765129bf3b599d365dcf
@@@ -8,8 -8,7 +8,8 @@@ git-send-pack - Push objects over git p
  
  SYNOPSIS
  --------
- 'git send-pack' [--all] [--dry-run] [--force] [--receive-pack=<git-receive-pack>] [--verbose] [--thin] [<host>:]<directory> [<ref>...]
 +[verse]
+ 'git send-pack' [--all] [--dry-run] [--force] [--receive-pack=<git-receive-pack>] [--quiet] [--verbose] [--thin] [<host>:]<directory> [<ref>...]
  
  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 b8cf45a7dd439b83c80bcf7a397e1b8e34c70f67,0393ab92b6e1e3eb310a373ef1558c87dea1c504..5798aa57b6bf7f47f4fd9c8b943602faaeee4b95
@@@ -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;
                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)
                        printf("\n");
                        fflush(stdout);
                } else {
 +                      fprintf(stderr, "Unknown command '%s'\n", buf.buf);
                        return 1;
                }
                strbuf_reset(&buf);