From: Junio C Hamano Date: Fri, 2 Mar 2007 08:31:51 +0000 (-0800) Subject: Merge branch 'maint' X-Git-Tag: v1.5.1-rc1~109 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/8b969a5fb5e5891d9ad4c236fd9487c4673bfa2a?ds=inline;hp=-c Merge branch 'maint' * maint: Another memory overrun in http-push.c fetch.o depends on the headers, too. Documentation: Correct minor typo in git-add documentation. Documentation/git-send-email.txt: Fix labeled list formatting Documentation/git-quiltimport.txt: Fix labeled list formatting Documentation/build-docdep.perl: Fix dependencies for included asciidoc files --- 8b969a5fb5e5891d9ad4c236fd9487c4673bfa2a diff --combined Makefile index 23ab7d6f9f,9f2cbe2cb9..9a37b15439 --- a/Makefile +++ b/Makefile @@@ -128,7 -128,6 +128,7 @@@ prefix = $(HOME bindir = $(prefix)/bin gitexecdir = $(bindir) template_dir = $(prefix)/share/git-core/templates/ +ETC_GITCONFIG = $(prefix)/etc/gitconfig # DESTDIR= # default configuration for gitweb @@@ -177,7 -176,7 +177,7 @@@ SCRIPT_SH = git-merge-one-file.sh git-parse-remote.sh \ git-pull.sh git-rebase.sh \ git-repack.sh git-request-pull.sh git-reset.sh \ - git-resolve.sh git-revert.sh git-sh-setup.sh \ + git-revert.sh git-sh-setup.sh \ git-tag.sh git-verify-tag.sh \ git-applymbox.sh git-applypatch.sh git-am.sh \ git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \ @@@ -267,8 -266,7 +267,8 @@@ LIB_OBJS = revision.o pager.o tree-walk.o xdiff-interface.o \ write_or_die.o trace.o list-objects.o grep.o \ alloc.o merge-file.o path-list.o help.o unpack-trees.o $(DIFF_OBJS) \ - color.o wt-status.o archive-zip.o archive-tar.o shallow.o utf8.o + color.o wt-status.o archive-zip.o archive-tar.o shallow.o utf8.o \ + convert.o BUILTIN_OBJS = \ builtin-add.o \ @@@ -277,7 -275,6 +277,7 @@@ builtin-archive.o \ builtin-blame.o \ builtin-branch.o \ + builtin-bundle.o \ builtin-cat-file.o \ builtin-checkout-index.o \ builtin-check-ref-format.o \ @@@ -287,6 -284,7 +287,6 @@@ builtin-diff.o \ builtin-diff-files.o \ builtin-diff-index.o \ - builtin-diff-stages.o \ builtin-diff-tree.o \ builtin-fmt-merge-msg.o \ builtin-for-each-ref.o \ @@@ -298,7 -296,6 +298,7 @@@ builtin-ls-tree.o \ builtin-mailinfo.o \ builtin-mailsplit.o \ + builtin-merge-base.o \ builtin-merge-file.o \ builtin-mv.o \ builtin-name-rev.o \ @@@ -600,7 -597,6 +600,7 @@@ endi # Shell quote (do not use $(call) to accommodate ancient setups); SHA1_HEADER_SQ = $(subst ','\'',$(SHA1_HEADER)) +ETC_GITCONFIG_SQ = $(subst ','\'',$(ETC_GITCONFIG)) DESTDIR_SQ = $(subst ','\'',$(DESTDIR)) bindir_SQ = $(subst ','\'',$(bindir)) @@@ -613,8 -609,7 +613,8 @@@ PERL_PATH_SQ = $(subst ','\'',$(PERL_PA LIBS = $(GITLIBS) $(EXTLIBS) -BASIC_CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER_SQ)' $(COMPAT_CFLAGS) +BASIC_CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER_SQ)' \ + -DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"' $(COMPAT_CFLAGS) LIB_OBJS += $(COMPAT_OBJS) ALL_CFLAGS += $(BASIC_CFLAGS) @@@ -780,7 -775,7 +780,7 @@@ git-http-push$X: revision.o http.o http $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \ $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) - $(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H) + $(LIB_OBJS) $(BUILTIN_OBJS) fetch.o: $(LIB_H) $(patsubst git-%$X,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h) $(DIFF_OBJS): diffcore.h @@@ -830,7 -825,7 +830,7 @@@ GIT-CFLAGS: .FORCE-GIT-CFLAG export NO_SVN_TESTS -test: all +test: all test-chmtime$X $(MAKE) -C t/ all test-date$X: test-date.c date.o ctype.o @@@ -845,9 -840,6 +845,9 @@@ test-dump-cache-tree$X: dump-cache-tree test-sha1$X: test-sha1.o $(GITLIBS) $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) +test-chmtime$X: test-chmtime.c + $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $< + check-sha1:: test-sha1$X ./test-sha1.sh diff --combined http-push.c index 68b78b538a,6af9aeceea..cbb02d3bc1 --- a/http-push.c +++ b/http-push.c @@@ -479,7 -479,7 +479,7 @@@ static void start_put(struct transfer_r char *hex = sha1_to_hex(request->obj->sha1); struct active_request_slot *slot; char *posn; - char type[20]; + enum object_type type; char hdr[50]; void *unpacked; unsigned long len; @@@ -487,8 -487,8 +487,8 @@@ ssize_t size; z_stream stream; - unpacked = read_sha1_file(request->obj->sha1, type, &len); - hdrlen = sprintf(hdr, "%s %lu", type, len) + 1; + unpacked = read_sha1_file(request->obj->sha1, &type, &len); + hdrlen = sprintf(hdr, "%s %lu", typename(type), len) + 1; /* Set it up */ memset(&stream, 0, sizeof(stream)); @@@ -1060,8 -1060,8 +1060,8 @@@ static int fetch_indices(void case 'P': i++; if (i + 52 < buffer.posn && - !strncmp(data + i, " pack-", 6) && - !strncmp(data + i + 46, ".pack\n", 6)) { + !prefixcmp(data + i, " pack-") && + !prefixcmp(data + i + 46, ".pack\n")) { get_sha1_hex(data + i + 6, sha1); setup_index(sha1); i += 51; @@@ -1206,11 -1206,11 +1206,11 @@@ static void handle_new_lock_ctx(struct lock->owner = xmalloc(strlen(ctx->cdata) + 1); strcpy(lock->owner, ctx->cdata); } else if (!strcmp(ctx->name, DAV_ACTIVELOCK_TIMEOUT)) { - if (!strncmp(ctx->cdata, "Second-", 7)) + if (!prefixcmp(ctx->cdata, "Second-")) lock->timeout = strtol(ctx->cdata + 7, NULL, 10); } else if (!strcmp(ctx->name, DAV_ACTIVELOCK_TOKEN)) { - if (!strncmp(ctx->cdata, "opaquelocktoken:", 16)) { + if (!prefixcmp(ctx->cdata, "opaquelocktoken:")) { lock->token = xmalloc(strlen(ctx->cdata) - 15); strcpy(lock->token, ctx->cdata + 16); } @@@ -1271,7 -1271,9 +1271,9 @@@ xml_cdata(void *userData, const XML_Cha struct xml_ctx *ctx = (struct xml_ctx *)userData; free(ctx->cdata); ctx->cdata = xmalloc(len + 1); - strlcpy(ctx->cdata, s, len + 1); + /* NB: 's' is not null-terminated, can not use strlcpy here */ + memcpy(ctx->cdata, s, len); + ctx->cdata[len] = '\0'; } static struct remote_lock *lock_remote(const char *path, long timeout) @@@ -1473,7 -1475,8 +1475,8 @@@ static void process_ls_object(struct re return; path += 8; obj_hex = xmalloc(strlen(path)); - strlcpy(obj_hex, path, 3); + /* NB: path is not null-terminated, can not use strlcpy here */ + memcpy(obj_hex, path, 2); strcpy(obj_hex + 2, path + 3); one_remote_object(obj_hex); free(obj_hex); @@@ -2168,9 -2171,10 +2171,10 @@@ static void fetch_symref(const char *pa return; /* If it's a symref, set the refname; otherwise try for a sha1 */ - if (!strncmp((char *)buffer.buffer, "ref: ", 5)) { + if (!prefixcmp((char *)buffer.buffer, "ref: ")) { *symref = xmalloc(buffer.posn - 5); - strlcpy(*symref, (char *)buffer.buffer + 5, buffer.posn - 5); + memcpy(*symref, (char *)buffer.buffer + 5, buffer.posn - 6); + (*symref)[buffer.posn - 6] = '\0'; } else { get_sha1_hex(buffer.buffer, sha1); }