From: Shawn O. Pearce Date: Wed, 8 Oct 2008 15:05:43 +0000 (-0700) Subject: Merge branch 'maint' X-Git-Tag: v1.6.1-rc1~171 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/c4f6a48969b33e7fec8fce592e38a60849782d2a?hp=-c Merge branch 'maint' * maint: Do not use errno when pread() returns 0 git init: --bare/--shared overrides system/global config git-push.txt: Describe --repo option in more detail git rm: refresh index before up-to-date check Fix a few typos in relnotes --- c4f6a48969b33e7fec8fce592e38a60849782d2a diff --combined builtin-push.c index cc6666f75e,f5cc76266b..122fdcfbdc --- a/builtin-push.c +++ b/builtin-push.c @@@ -10,7 -10,7 +10,7 @@@ #include "parse-options.h" static const char * const push_usage[] = { - "git push [--all | --mirror] [--dry-run] [--tags] [--receive-pack=] [--repo=all] [-f | --force] [-v] [ ...]", + "git push [--all | --mirror] [--dry-run] [--tags] [--receive-pack=] [--repo=] [-f | --force] [-v] [ ...]", NULL, }; @@@ -59,17 -59,8 +59,17 @@@ static int do_push(const char *repo, in if (remote->mirror) flags |= (TRANSPORT_PUSH_MIRROR|TRANSPORT_PUSH_FORCE); - if ((flags & (TRANSPORT_PUSH_ALL|TRANSPORT_PUSH_MIRROR)) && refspec) - return -1; + if ((flags & TRANSPORT_PUSH_ALL) && refspec) { + if (!strcmp(*refspec, "refs/tags/*")) + return error("--all and --tags are incompatible"); + return error("--all can't be combined with refspecs"); + } + + if ((flags & TRANSPORT_PUSH_MIRROR) && refspec) { + if (!strcmp(*refspec, "refs/tags/*")) + return error("--mirror and --tags are incompatible"); + return error("--mirror can't be combined with refspecs"); + } if ((flags & (TRANSPORT_PUSH_ALL|TRANSPORT_PUSH_MIRROR)) == (TRANSPORT_PUSH_ALL|TRANSPORT_PUSH_MIRROR)) { diff --combined index-pack.c index 2e4c0885f2,c45ae20e8f..73860bf3da --- a/index-pack.c +++ b/index-pack.c @@@ -67,7 -67,7 +67,7 @@@ static struct progress *progress static unsigned char input_buffer[4096]; static unsigned int input_offset, input_len; static off_t consumed_bytes; -static SHA_CTX input_ctx; +static git_SHA_CTX input_ctx; static uint32_t input_crc32; static int input_fd, output_fd, pack_fd; @@@ -119,7 -119,7 +119,7 @@@ static void flush(void if (input_offset) { if (output_fd >= 0) write_or_die(output_fd, input_buffer, input_offset); - SHA1_Update(&input_ctx, input_buffer, input_offset); + git_SHA1_Update(&input_ctx, input_buffer, input_offset); memmove(input_buffer, input_buffer + input_offset, input_len); input_offset = 0; } @@@ -188,7 -188,7 +188,7 @@@ static char *open_pack_file(char *pack_ output_fd = -1; pack_fd = input_fd; } - SHA1_Init(&input_ctx); + git_SHA1_Init(&input_ctx); return pack_name; } @@@ -365,8 -365,11 +365,11 @@@ static void *get_data_from_pack(struct data = src; do { ssize_t n = pread(pack_fd, data + rdy, len - rdy, from + rdy); - if (n <= 0) + if (n < 0) die("cannot pread pack file: %s", strerror(errno)); + if (!n) + die("premature end of pack file, %lu bytes missing", + len - rdy); rdy += n; } while (rdy < len); data = xmalloc(obj->size); @@@ -588,7 -591,7 +591,7 @@@ static void parse_pack_objects(unsigne /* Check pack integrity */ flush(); - SHA1_Final(sha1, &input_ctx); + git_SHA1_Final(sha1, &input_ctx); if (hashcmp(fill(20), sha1)) die("pack is corrupted (SHA1 mismatch)"); use(20);