From: Junio C Hamano Date: Sun, 2 Nov 2008 07:15:22 +0000 (-0700) Subject: Merge branch 'maint' X-Git-Tag: v1.6.1-rc1~103 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/aebd173ffa7a4e67447f0157a14abde7767c54e9?ds=inline;hp=-c Merge branch 'maint' * maint: Start 1.6.0.4 cycle add instructions on how to send patches to the mailing list with Gmail Documentation/gitattributes: Add subsection header for each attribute git send-email: avoid leaking directory file descriptors. send-pack: do not send out single-level refs such as refs/stash fix overlapping memcpy in normalize_absolute_path pack-objects: avoid reading uninitalized data correct cache_entry allocation Conflicts: RelNotes --- aebd173ffa7a4e67447f0157a14abde7767c54e9 diff --combined Documentation/SubmittingPatches index a1e9100f9e,c59edfa6a9..f0295c60f5 --- a/Documentation/SubmittingPatches +++ b/Documentation/SubmittingPatches @@@ -71,7 -71,7 +71,7 @@@ run git diff --check on your changes be (1a) Try to be nice to older C compilers -We try to support wide range of C compilers to compile +We try to support a wide range of C compilers to compile git with. That means that you should not use C99 initializers, even if a lot of compilers grok it. @@@ -456,3 -456,30 +456,30 @@@ This should help you to submit patches 5) Back in the compose window: add whatever other text you wish to the message, complete the addressing and subject fields, and press send. + + + Gmail + ----- + + Submitting properly formatted patches via Gmail is simple now that + IMAP support is available. First, edit your ~/.gitconfig to specify your + account settings: + + [imap] + folder = "[Gmail]/Drafts" + host = imaps://imap.gmail.com + user = user@gmail.com + pass = p4ssw0rd + port = 993 + sslverify = false + + Next, ensure that your Gmail settings are correct. In "Settings" the + "Use Unicode (UTF-8) encoding for outgoing messages" should be checked. + + Once your commits are ready to send to the mailing list, run the following + command to send the patch emails to your Gmail Drafts folder. + + $ git format-patch -M --stdout origin/master | git imap-send + + Go to your Gmail account, open the Drafts folder, find the patch email, fill + in the To: and CC: fields and send away! diff --combined Documentation/gitattributes.txt index 24e880c5be,37fff208ff..eb648418ee --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@@ -213,6 -213,9 +213,9 @@@ with `crlf`, and then `ident` and fed t Generating diff text ~~~~~~~~~~~~~~~~~~~~ + `diff` + ^^^^^^ + The attribute `diff` affects if 'git-diff' generates textual patch for the path or just says `Binary files differ`. It also can affect what line is shown on the hunk header `@@ -k,l +n,m @@` @@@ -311,18 -314,10 +314,18 @@@ patterns are available - `bibtex` suitable for files with BibTeX coded references. +- `html` suitable for HTML/XHTML documents. + - `java` suitable for source code in the Java language. +- `objc` suitable for source code in the Objective-C language. + - `pascal` suitable for source code in the Pascal/Delphi language. +- `php` suitable for source code in the PHP language. + +- `python` suitable for source code in the Python language. + - `ruby` suitable for source code in the Ruby language. - `tex` suitable for source code for LaTeX documents. @@@ -331,6 -326,9 +334,9 @@@ Performing a three-way merge ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + `merge` + ^^^^^^^ + The attribute `merge` affects how three versions of a file is merged when a file-level merge is necessary during `git merge`, and other programs such as `git revert` and `git cherry-pick`. diff --combined builtin-pack-objects.c index 59c30d1caa,b0dddbee4f..15b80db5a1 --- a/builtin-pack-objects.c +++ b/builtin-pack-objects.c @@@ -1369,13 -1369,15 +1369,13 @@@ static void find_deltas(struct object_e int window, int depth, unsigned *processed) { uint32_t i, idx = 0, count = 0; - unsigned int array_size = window * sizeof(struct unpacked); struct unpacked *array; unsigned long mem_usage = 0; - array = xmalloc(array_size); - memset(array, 0, array_size); + array = xcalloc(window, sizeof(struct unpacked)); for (;;) { - struct object_entry *entry = *list++; + struct object_entry *entry; struct unpacked *n = array + idx; int j, max_depth, best_base = -1; @@@ -1384,6 -1386,7 +1384,7 @@@ progress_unlock(); break; } + entry = *list++; (*list_size)--; if (!entry->preferred_base) { (*processed)++; @@@ -1723,14 -1726,6 +1724,14 @@@ static void prepare_pack(int window, in if (entry->type < 0) die("unable to get type of object %s", sha1_to_hex(entry->idx.sha1)); + } else { + if (entry->type < 0) { + /* + * This object is not found, but we + * don't have to include it anyway. + */ + continue; + } } delta_list[n++] = entry; diff --combined builtin-send-pack.c index 910db92b62,301f230432..d68ce2d0e3 --- a/builtin-send-pack.c +++ b/builtin-send-pack.c @@@ -18,7 -18,7 +18,7 @@@ static struct send_pack_args args = /* * Make a pack stream and spit it out into file descriptor fd */ -static int pack_objects(int fd, struct ref *refs) +static int pack_objects(int fd, struct ref *refs, struct extra_have_objects *extra) { /* * The child becomes pack-objects --revs; we feed @@@ -34,8 -34,6 +34,8 @@@ NULL, }; struct child_process po; + int i; + char buf[42]; if (args.use_thin_pack) argv[4] = "--thin"; @@@ -51,15 -49,9 +51,15 @@@ * We feed the pack-objects we just spawned with revision * parameters by writing to the pipe. */ - while (refs) { - char buf[42]; + for (i = 0; i < extra->nr; i++) { + memcpy(buf + 1, sha1_to_hex(&extra->array[i][0]), 40); + buf[0] = '^'; + buf[41] = '\n'; + if (!write_or_whine(po.in, buf, 42, "send-pack: send refs")) + break; + } + while (refs) { if (!is_null_sha1(refs->old_sha1) && has_sha1_file(refs->old_sha1)) { memcpy(buf + 1, sha1_to_hex(refs->old_sha1), 40); @@@ -140,7 -132,13 +140,13 @@@ static struct ref *remote_refs, **remot static int one_local_ref(const char *refname, const unsigned char *sha1, int flag, void *cb_data) { struct ref *ref; - int len = strlen(refname) + 1; + int len; + + /* we already know it starts with refs/ to get here */ + if (check_ref_format(refname + 5)) + return 0; + + len = strlen(refname) + 1; ref = xcalloc(1, sizeof(*ref) + len); hashcpy(ref->new_sha1, sha1); memcpy(ref->name, refname, len); @@@ -389,17 -387,14 +395,17 @@@ static int do_send_pack(int in, int out int expect_status_report = 0; int flags = MATCH_REFS_NONE; int ret; + struct extra_have_objects extra_have; + memset(&extra_have, 0, sizeof(extra_have)); if (args.send_all) flags |= MATCH_REFS_ALL; if (args.send_mirror) flags |= MATCH_REFS_MIRROR; /* No funny business with the matcher */ - remote_tail = get_remote_heads(in, &remote_refs, 0, NULL, REF_NORMAL); + remote_tail = get_remote_heads(in, &remote_refs, 0, NULL, REF_NORMAL, + &extra_have); get_local_heads(); /* Does the other end support the reporting? */ @@@ -507,7 -502,7 +513,7 @@@ packet_flush(out); if (new_refs && !args.dry_run) { - if (pack_objects(out, remote_refs) < 0) + if (pack_objects(out, remote_refs, &extra_have) < 0) return -1; } else diff --combined git-send-email.perl index bdbfac6625,18529c76e6..94ca5c89ad --- a/git-send-email.perl +++ b/git-send-email.perl @@@ -39,40 -39,75 +39,40 @@@ package main sub usage { print <... -Options: - --from Specify the "From:" line of the email to be sent. - --to Specify the primary "To:" line of the email. - - --cc Specify an initial "Cc:" list for the entire series - of emails. - - --cc-cmd Specify a command to execute per file which adds - per file specific cc address entries - - --bcc Specify a list of email addresses that should be Bcc: - on all the emails. - - --compose Use \$GIT_EDITOR, core.editor, \$EDITOR, or \$VISUAL to edit - an introductory message for the patch series. - - --subject Specify the initial "Subject:" line. - Only necessary if --compose is also set. If --compose - is not set, this will be prompted for. - - --in-reply-to Specify the first "In-Reply-To:" header line. - Only used if --compose is also set. If --compose is not - set, this will be prompted for. - - --chain-reply-to If set, the replies will all be to the previous - email sent, rather than to the first email sent. - Defaults to on. - - --signed-off-cc Automatically add email addresses that appear in - Signed-off-by: or Cc: lines to the cc: list. Defaults to on. - - --identity The configuration identity, a subsection to prioritise over - the default section. - - --smtp-server If set, specifies the outgoing SMTP server to use. - Defaults to localhost. Port number can be specified here with - hostname:port format or by using --smtp-server-port option. - - --smtp-server-port Specify a port on the outgoing SMTP server to connect to. - - --smtp-user The username for SMTP-AUTH. - - --smtp-pass The password for SMTP-AUTH. - - --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 - avoid copying yourself, 'sob' for Signed-off-by lines, - 'cccmd' for the output of the cccmd, or 'all' to suppress - all of these. - - --suppress-from Suppress sending emails to yourself. Defaults to off. - - --thread Specify that the "In-Reply-To:" header should be set on all - emails. Defaults to on. - - --quiet Make git-send-email less verbose. One line per email - should be all that is output. - - --dry-run Do everything except actually send the emails. - - --envelope-sender Specify the envelope sender used to send the emails. - - --no-validate Don't perform any sanity checks on patches. + Composing: + --from * Email From: + --to * Email To: + --cc * Email Cc: + --bcc * Email Bcc: + --subject * Email "Subject:" + --in-reply-to * Email "In-Reply-To:" + --compose * Open an editor for introduction. + + Sending: + --envelope-sender * Email envelope sender. + --smtp-server * Outgoing SMTP server to use. The port + is optional. Default 'localhost'. + --smtp-server-port * Outgoing SMTP server port. + --smtp-user * Username for SMTP-AUTH. + --smtp-pass * Password for SMTP-AUTH; not necessary. + --smtp-encryption * tls or ssl; anything else disables. + --smtp-ssl * Deprecated. Use '--smtp-encryption ssl'. + + Automating: + --identity * Use the sendemail. options. + --cc-cmd * Email Cc: via ` \$patch_path` + --suppress-cc * author, self, sob, cccmd, all. + --[no-]signed-off-by-cc * Send to Cc: and Signed-off-by: + addresses. Default on. + --[no-]suppress-from * Send to self. Default off. + --[no-]chain-reply-to * Chain In-Reply-To: fields. Default on. + --[no-]thread * Use In-Reply-To: field. Default on. + + Administering: + --quiet * Output one line of info per email. + --dry-run * Don't actually send the emails. + --[no-]validate * Perform patch sanity checks. Default on. EOT exit(1); @@@ -151,19 -186,17 +151,19 @@@ if ($@) my ($quiet, $dry_run) = (0, 0); # Variables with corresponding config settings -my ($thread, $chain_reply_to, $suppress_from, $signed_off_cc, $cc_cmd); +my ($thread, $chain_reply_to, $suppress_from, $signed_off_by_cc, $cc_cmd); my ($smtp_server, $smtp_server_port, $smtp_authuser, $smtp_encryption); my ($identity, $aliasfiletype, @alias_files, @smtp_host_parts); -my ($no_validate); +my ($validate); my (@suppress_cc); my %config_bool_settings = ( "thread" => [\$thread, 1], "chainreplyto" => [\$chain_reply_to, 1], "suppressfrom" => [\$suppress_from, undef], - "signedoffcc" => [\$signed_off_cc, undef], + "signedoffbycc" => [\$signed_off_by_cc, undef], + "signedoffcc" => [\$signed_off_by_cc, undef], # Deprecated + "validate" => [\$validate, 1], ); my %config_settings = ( @@@ -226,11 -259,11 +226,11 @@@ my $rc = GetOptions("sender|from=s" => "cc-cmd=s" => \$cc_cmd, "suppress-from!" => \$suppress_from, "suppress-cc=s" => \@suppress_cc, - "signed-off-cc|signed-off-by-cc!" => \$signed_off_cc, + "signed-off-cc|signed-off-by-cc!" => \$signed_off_by_cc, "dry-run" => \$dry_run, "envelope-sender=s" => \$envelope_sender, "thread!" => \$thread, - "no-validate" => \$no_validate, + "validate!" => \$validate, ); unless ($rc) { @@@ -302,7 -335,7 +302,7 @@@ if ($suppress_cc{'all'}) # If explicit old-style ones are specified, they trump --suppress-cc. $suppress_cc{'self'} = $suppress_from if defined $suppress_from; -$suppress_cc{'sob'} = !$signed_off_cc if defined $signed_off_cc; +$suppress_cc{'sob'} = !$signed_off_by_cc if defined $signed_off_by_cc; # Debugging, print out the suppressions. if (0) { @@@ -374,16 -407,15 +374,15 @@@ for my $f (@ARGV) push @files, grep { -f $_ } map { +$f . "/" . $_ } sort readdir(DH); - + closedir(DH); } elsif (-f $f or -p $f) { push @files, $f; - } else { print STDERR "Skipping $f - not found.\n"; } } -if (!$no_validate) { +if ($validate) { foreach my $f (@files) { unless (-p $f) { my $error = validate_patch($f);