From: Junio C Hamano Date: Fri, 25 Jul 2008 20:56:36 +0000 (-0700) Subject: Merge branch 'maint' X-Git-Tag: v1.6.0-rc1~39 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/d9d9e6ee6366fed93a4beff3994bad376f81eabd?ds=inline;hp=-c Merge branch 'maint' * maint: Makefile: fix shell quoting tests: propagate $(TAR) down from the toplevel Makefile index-pack.c: correctly initialize appended objects send-email: find body-encoding correctly --- d9d9e6ee6366fed93a4beff3994bad376f81eabd diff --combined Makefile index b01cf1c993,f13184b2ba..f4b8e38e80 --- a/Makefile +++ b/Makefile @@@ -174,7 -174,7 +174,7 @@@ prefix = $(HOME bindir = $(prefix)/bin mandir = $(prefix)/share/man infodir = $(prefix)/share/info -gitexecdir = $(bindir) +gitexecdir = $(prefix)/libexec/git-core sharedir = $(prefix)/share template_dir = $(sharedir)/git-core/templates htmldir=$(sharedir)/doc/git-doc @@@ -205,7 -205,7 +205,7 @@@ GITWEB_FAVICON = git-favicon.pn GITWEB_SITE_HEADER = GITWEB_SITE_FOOTER = -export prefix bindir gitexecdir sharedir template_dir htmldir sysconfdir +export prefix bindir gitexecdir sharedir htmldir sysconfdir CC = gcc AR = ar @@@ -240,6 -240,8 +240,6 @@@ SCRIPT_SH += git-lost-found.s SCRIPT_SH += git-merge-octopus.sh SCRIPT_SH += git-merge-one-file.sh SCRIPT_SH += git-merge-resolve.sh -SCRIPT_SH += git-merge.sh -SCRIPT_SH += git-merge-stupid.sh SCRIPT_SH += git-mergetool.sh SCRIPT_SH += git-parse-remote.sh SCRIPT_SH += git-pull.sh @@@ -271,9 -273,11 +271,9 @@@ EXTRA_PROGRAMS # ... and all the rest that could be moved out of bindir to gitexecdir PROGRAMS += $(EXTRA_PROGRAMS) -PROGRAMS += git-daemon$X PROGRAMS += git-fast-import$X PROGRAMS += git-fetch-pack$X PROGRAMS += git-hash-object$X -PROGRAMS += git-imap-send$X PROGRAMS += git-index-pack$X PROGRAMS += git-merge-index$X PROGRAMS += git-merge-tree$X @@@ -324,7 -328,6 +324,7 @@@ endi export PERL_PATH LIB_FILE=libgit.a +COMPAT_LIB = compat/lib.a XDIFF_LIB=xdiff/lib.a LIB_H += archive.h @@@ -334,7 -337,6 +334,7 @@@ LIB_H += builtin. LIB_H += cache.h LIB_H += cache-tree.h LIB_H += commit.h +LIB_H += compat/mingw.h LIB_H += csum-file.h LIB_H += decorate.h LIB_H += delta.h @@@ -352,18 -354,16 +352,18 @@@ LIB_H += log-tree. LIB_H += mailmap.h LIB_H += object.h LIB_H += pack.h +LIB_H += pack-refs.h LIB_H += pack-revindex.h LIB_H += parse-options.h LIB_H += patch-ids.h -LIB_H += path-list.h +LIB_H += string-list.h LIB_H += pkt-line.h LIB_H += progress.h LIB_H += quote.h LIB_H += reflog-walk.h LIB_H += refs.h LIB_H += remote.h +LIB_H += rerere.h LIB_H += revision.h LIB_H += run-command.h LIB_H += sha1-lookup.h @@@ -377,7 -377,6 +377,7 @@@ LIB_H += unpack-trees. LIB_H += utf8.h LIB_H += wt-status.h +LIB_OBJS += abspath.o LIB_OBJS += alias.o LIB_OBJS += alloc.o LIB_OBJS += archive.o @@@ -430,14 -429,13 +430,14 @@@ LIB_OBJS += merge-file. LIB_OBJS += name-hash.o LIB_OBJS += object.o LIB_OBJS += pack-check.o +LIB_OBJS += pack-refs.o LIB_OBJS += pack-revindex.o LIB_OBJS += pack-write.o LIB_OBJS += pager.o LIB_OBJS += parse-options.o LIB_OBJS += patch-delta.o LIB_OBJS += patch-ids.o -LIB_OBJS += path-list.o +LIB_OBJS += string-list.o LIB_OBJS += path.o LIB_OBJS += pkt-line.o LIB_OBJS += pretty.o @@@ -448,7 -446,6 +448,7 @@@ LIB_OBJS += read-cache. LIB_OBJS += reflog-walk.o LIB_OBJS += refs.o LIB_OBJS += remote.o +LIB_OBJS += rerere.o LIB_OBJS += revision.o LIB_OBJS += run-command.o LIB_OBJS += server-info.o @@@ -470,7 -467,6 +470,7 @@@ LIB_OBJS += unpack-trees. LIB_OBJS += usage.o LIB_OBJS += utf8.o LIB_OBJS += walker.o +LIB_OBJS += wrapper.o LIB_OBJS += write_or_die.o LIB_OBJS += ws.o LIB_OBJS += wt-status.o @@@ -515,7 -511,6 +515,7 @@@ BUILTIN_OBJS += builtin-ls-remote. BUILTIN_OBJS += builtin-ls-tree.o BUILTIN_OBJS += builtin-mailinfo.o BUILTIN_OBJS += builtin-mailsplit.o +BUILTIN_OBJS += builtin-merge.o BUILTIN_OBJS += builtin-merge-base.o BUILTIN_OBJS += builtin-merge-file.o BUILTIN_OBJS += builtin-merge-ours.o @@@ -718,36 -713,6 +718,36 @@@ ifeq ($(uname_S),HP-UX NO_HSTRERROR = YesPlease NO_SYS_SELECT_H = YesPlease endif +ifneq (,$(findstring MINGW,$(uname_S))) + NO_MMAP = YesPlease + NO_PREAD = YesPlease + NO_OPENSSL = YesPlease + NO_CURL = YesPlease + NO_SYMLINK_HEAD = YesPlease + NO_IPV6 = YesPlease + NO_SETENV = YesPlease + NO_UNSETENV = YesPlease + NO_STRCASESTR = YesPlease + NO_STRLCPY = YesPlease + NO_MEMMEM = YesPlease + NEEDS_LIBICONV = YesPlease + OLD_ICONV = YesPlease + NO_C99_FORMAT = YesPlease + NO_STRTOUMAX = YesPlease + NO_MKDTEMP = YesPlease + SNPRINTF_RETURNS_BOGUS = YesPlease + NO_SVN_TESTS = YesPlease + NO_PERL_MAKEMAKER = YesPlease + NO_POSIX_ONLY_PROGRAMS = YesPlease + COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat + COMPAT_CFLAGS += -DSNPRINTF_SIZE_CORR=1 + COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\" + COMPAT_OBJS += compat/mingw.o compat/fnmatch.o compat/regex.o compat/winansi.o + EXTLIBS += -lws2_32 + X = .exe + template_dir = ../share/git-core/templates/ + ETC_GITCONFIG = ../etc/gitconfig +endif ifneq (,$(findstring arm,$(uname_M))) ARM_SHA1 = YesPlease endif @@@ -808,10 -773,6 +808,10 @@@ ifdef ZLIB_PAT endif EXTLIBS += -lz +ifndef NO_POSIX_ONLY_PROGRAMS + PROGRAMS += git-daemon$X + PROGRAMS += git-imap-send$X +endif ifndef NO_OPENSSL OPENSSL_LIBSSL = -lssl ifdef OPENSSLDIR @@@ -1204,12 -1165,6 +1204,12 @@@ git-http-push$X: revision.o http.o http $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \ $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) +$(COMPAT_LIB): $(COMPAT_OBJS) + $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(COMPAT_OBJS) + +git-shell$X: abspath.o ctype.o exec_cmd.o quote.o strbuf.o usage.o wrapper.o shell.o $(COMPAT_LIB) + $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(COMPAT_LIB) + $(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H) $(patsubst git-%$X,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h) builtin-revert.o wt-status.o: wt-status.h @@@ -1255,8 -1210,12 +1255,12 @@@ GIT-CFLAGS: .FORCE-GIT-CFLAG echo "$$FLAGS" >GIT-CFLAGS; \ fi + # We need to apply sq twice, once to protect from the shell + # that runs GIT-BUILD-OPTIONS, and then again to protect it + # and the first level quoting from the shell that runs "echo". GIT-BUILD-OPTIONS: .FORCE-GIT-BUILD-OPTIONS - @echo SHELL_PATH=\''$(SHELL_PATH_SQ)'\' >$@ + @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@ + @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@ ### Detect Tck/Tk interpreter path changes ifndef NO_TCLTK @@@ -1274,7 -1233,7 +1278,7 @@@ endi ### Testing rules -TEST_PROGRAMS = test-chmtime$X test-genrandom$X test-date$X test-delta$X test-sha1$X test-match-trees$X test-absolute-path$X test-parse-options$X +TEST_PROGRAMS = test-chmtime$X test-genrandom$X test-date$X test-delta$X test-sha1$X test-match-trees$X test-parse-options$X test-path-utils$X all:: $(TEST_PROGRAMS) @@@ -1305,22 -1264,15 +1309,22 @@@ check: common-cmds. for i in *.c; do sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; done remove-dashes: - ./fixup-builtins $(BUILT_INS) + ./fixup-builtins $(BUILT_INS) $(PROGRAMS) $(SCRIPTS) ### Installation rules +ifeq ($(firstword $(subst /, ,$(template_dir))),..) +template_instdir = $(gitexecdir)/$(template_dir) +else +template_instdir = $(template_dir) +endif +export template_instdir + install: all $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)' $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexecdir_SQ)' $(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexecdir_SQ)' - $(INSTALL) git$X '$(DESTDIR_SQ)$(bindir_SQ)' + $(INSTALL) git$X git-upload-pack$X git-receive-pack$X git-upload-archive$X '$(DESTDIR_SQ)$(bindir_SQ)' $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install $(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install ifndef NO_TCLTK @@@ -1338,14 -1290,10 +1342,14 @@@ endi ifneq (,$X) $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), $(RM) '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p';) endif + ./check_bindir 'z$(bindir_SQ)' 'z$(gitexecdir_SQ)' '$(DESTDIR_SQ)$(bindir_SQ)/git-shell$X' install-doc: $(MAKE) -C Documentation install +install-html: + $(MAKE) -C Documentation install-html + install-info: $(MAKE) -C Documentation install-info @@@ -1406,7 -1354,7 +1410,7 @@@ distclean: clea clean: $(RM) *.o mozilla-sha1/*.o arm/*.o ppc/*.o compat/*.o xdiff/*.o \ - $(LIB_FILE) $(XDIFF_LIB) + $(LIB_FILE) $(XDIFF_LIB) $(COMPAT_LIB) $(RM) $(ALL_PROGRAMS) $(BUILT_INS) git$X $(RM) $(TEST_PROGRAMS) $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags cscope* @@@ -1437,7 -1385,7 +1441,7 @@@ check-docs: do \ case "$$v" in \ git-merge-octopus | git-merge-ours | git-merge-recursive | \ - git-merge-resolve | git-merge-stupid | git-merge-subtree | \ + git-merge-resolve | git-merge-subtree | \ git-fsck-objects | git-init-db | \ git-?*--?* ) continue ;; \ esac ; \ diff --combined git-send-email.perl index 2e4a44ad29,385ff7c219..d2fd899076 --- a/git-send-email.perl +++ b/git-send-email.perl @@@ -38,7 -38,7 +38,7 @@@ package main sub usage { print <... +git send-email [options] ... Options: --from Specify the "From:" line of the email to be sent. @@@ -84,10 -84,7 +84,10 @@@ --smtp-pass The password for SMTP-AUTH. - --smtp-ssl If set, connects to the SMTP server using SSL. + --smtp-encryption Specify 'tls' for STARTTLS encryption, or 'ssl' for SSL. + Any other value disables the feature. + + --smtp-ssl Synonym for '--smtp-encryption=ssl'. Deprecated. --suppress-cc Suppress the specified category of auto-CC. The category can be one of 'author' for the patch author, 'self' to @@@ -187,7 -184,7 +187,7 @@@ my ($quiet, $dry_run) = (0, 0) # Variables with corresponding config settings my ($thread, $chain_reply_to, $suppress_from, $signed_off_cc, $cc_cmd); -my ($smtp_server, $smtp_server_port, $smtp_authuser, $smtp_ssl); +my ($smtp_server, $smtp_server_port, $smtp_authuser, $smtp_encryption); my ($identity, $aliasfiletype, @alias_files, @smtp_host_parts); my ($no_validate); my (@suppress_cc); @@@ -197,6 -194,7 +197,6 @@@ my %config_bool_settings = "chainreplyto" => [\$chain_reply_to, 1], "suppressfrom" => [\$suppress_from, undef], "signedoffcc" => [\$signed_off_cc, undef], - "smtpssl" => [\$smtp_ssl, 0], ); my %config_settings = ( @@@ -251,8 -249,7 +251,8 @@@ my $rc = GetOptions("sender|from=s" => "smtp-server-port=s" => \$smtp_server_port, "smtp-user=s" => \$smtp_authuser, "smtp-pass:s" => \$smtp_authpass, - "smtp-ssl!" => \$smtp_ssl, + "smtp-ssl" => sub { $smtp_encryption = 'ssl' }, + "smtp-encryption=s" => \$smtp_encryption, "identity=s" => \$identity, "compose" => \$compose, "quiet" => \$quiet, @@@ -292,15 -289,6 +292,15 @@@ sub read_config $$target = Git::config(@repo, "$prefix.$setting") unless (defined $$target); } } + + if (!defined $smtp_encryption) { + my $enc = Git::config(@repo, "$prefix.smtpencryption"); + if (defined $enc) { + $smtp_encryption = $enc; + } elsif (Git::config_bool(@repo, "$prefix.smtpssl")) { + $smtp_encryption = 'ssl'; + } + } } # read configuration from [sendemail "$identity"], fall back on [sendemail] @@@ -313,9 -301,6 +313,9 @@@ foreach my $setting (values %config_boo ${$setting->[0]} = $setting->[1] unless (defined (${$setting->[0]})); } +# 'default' encryption is none -- this only prevents a warning +$smtp_encryption = '' unless (defined $smtp_encryption); + # Set CC suppressions my(%suppress_cc); if (@suppress_cc) { @@@ -408,7 -393,7 +408,7 @@@ for my $f (@ARGV) push @files, grep { -f $_ } map { +$f . "/" . $_ } sort readdir(DH); - } elsif (-f $f) { + } elsif (-f $f or -p $f) { push @files, $f; } else { @@@ -418,10 -403,8 +418,10 @@@ if (!$no_validate) { foreach my $f (@files) { - my $error = validate_patch($f); - $error and die "fatal: $f: $error\nwarning: no patches were sent\n"; + unless (-p $f) { + my $error = validate_patch($f); + $error and die "fatal: $f: $error\nwarning: no patches were sent\n"; + } } } @@@ -755,7 -738,7 +755,7 @@@ X-Mailer: git-send-email $gitversio die "The required SMTP server is not properly defined." } - if ($smtp_ssl) { + if ($smtp_encryption eq 'ssl') { $smtp_server_port ||= 465; # ssmtp require Net::SMTP::SSL; $smtp ||= Net::SMTP::SSL->new($smtp_server, Port => $smtp_server_port); @@@ -765,21 -748,6 +765,21 @@@ $smtp ||= Net::SMTP->new((defined $smtp_server_port) ? "$smtp_server:$smtp_server_port" : $smtp_server); + if ($smtp_encryption eq 'tls') { + require Net::SMTP::SSL; + $smtp->command('STARTTLS'); + $smtp->response(); + if ($smtp->code == 220) { + $smtp = Net::SMTP::SSL->start_SSL($smtp) + or die "STARTTLS failed! ".$smtp->message; + $smtp_encryption = ''; + # Send EHLO again to receive fresh + # supported commands + $smtp->hello(); + } else { + die "Server does not support STARTTLS! ".$smtp->message; + } + } } if (!$smtp) { @@@ -882,7 -850,7 +882,7 @@@ foreach my $t (@files) } elsif (/^Content-type:/i) { $has_content_type = 1; - if (/charset="?[^ "]+/) { + if (/charset="?([^ "]+)/) { $body_encoding = $1; } push @xh, $_; diff --combined index-pack.c index ac20a46d15,7d5344abc0..52064befdb --- a/index-pack.c +++ b/index-pack.c @@@ -10,7 -10,7 +10,7 @@@ #include "fsck.h" static const char index_pack_usage[] = -"git-index-pack [-v] [-o ] [{ ---keep | --keep= }] [--strict] { | --stdin [--fix-thin] [] }"; +"git index-pack [-v] [-o ] [{ ---keep | --keep= }] [--strict] { | --stdin [--fix-thin] [] }"; struct object_entry { @@@ -200,8 -200,7 +200,8 @@@ static void parse_pack_header(void if (hdr->hdr_signature != htonl(PACK_SIGNATURE)) die("pack signature mismatch"); if (!pack_version_ok(hdr->hdr_version)) - die("pack version %d unsupported", ntohl(hdr->hdr_version)); + die("pack version %"PRIu32" unsupported", + ntohl(hdr->hdr_version)); nr_objects = ntohl(hdr->hdr_entries); use(sizeof(struct pack_header)); @@@ -699,6 -698,10 +699,10 @@@ static struct object_entry *append_obj_ write_or_die(output_fd, header, n); obj[0].idx.crc32 = crc32(0, Z_NULL, 0); obj[0].idx.crc32 = crc32(obj[0].idx.crc32, header, n); + obj[0].size = size; + obj[0].hdr_size = n; + obj[0].type = type; + obj[0].real_type = type; obj[1].idx.offset = obj[0].idx.offset + n; obj[1].idx.offset += write_compressed(output_fd, buf, size, &obj[0].idx.crc32); hashcpy(obj->idx.sha1, sha1); @@@ -856,8 -859,7 +860,8 @@@ static int git_index_pack_config(const if (!strcmp(k, "pack.indexversion")) { pack_idx_default_version = git_config_int(k, v); if (pack_idx_default_version > 2) - die("bad pack.indexversion=%d", pack_idx_default_version); + die("bad pack.indexversion=%"PRIu32, + pack_idx_default_version); return 0; } return git_default_config(k, v, cb); diff --combined t/t5000-tar-tree.sh index 3f1e25d921,87902f81ef..e395ff4e34 --- a/t/t5000-tar-tree.sh +++ b/t/t5000-tar-tree.sh @@@ -25,7 -25,6 +25,6 @@@ commit id embedding ' . ./test-lib.sh - TAR=${TAR:-tar} UNZIP=${UNZIP:-unzip} SUBSTFORMAT=%H%n @@@ -44,11 -43,6 +43,11 @@@ test_expect_success echo text >file_with_long_path) && (cd a && find .) | sort >a.lst' +test_expect_success \ + 'add ignored file' \ + 'echo ignore me >a/ignored && + echo ignored export-ignore >.gitattributes' + test_expect_success \ 'add files to repository' \ 'find a -type f | xargs git update-index --add && @@@ -58,10 -52,6 +57,10 @@@ git update-ref HEAD $(TZ=GMT GIT_COMMITTER_DATE="2005-05-27 22:00:00" \ git commit-tree $treeid b.tar' @@@ -77,7 -67,7 +76,7 @@@ test_expect_success test_expect_success \ 'validate file modification time' \ 'mkdir extract && - $TAR xf b.tar -C extract a/a && + "$TAR" xf b.tar -C extract a/a && perl -e '\''print((stat("extract/a/a"))[9], "\n")'\'' >b.mtime && echo "1117231200" >expected.mtime && diff expected.mtime b.mtime' @@@ -89,7 -79,7 +88,7 @@@ test_expect_success test_expect_success \ 'extract tar archive' \ - '(cd b && $TAR xf -)