From 2da1f36671c3e3e28eba6a56d92249b6671c07d3 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Sat, 13 Sep 2014 21:30:38 -0400 Subject: [PATCH 01/11] mailinfo: make ">From" in-body header check more robust Since commit 81c5cf7 (mailinfo: skip bogus UNIX From line inside body, 2006-05-21), we have treated lines like ">From" in the body as headers. This makes "git am" work for people who erroneously paste the whole output from format-patch: From 12345abcd...fedcba543210 Mon Sep 17 00:00:00 2001 From: them Subject: [PATCH] whatever into their email body (assuming that an mbox writer then quotes "From" as ">From", as otherwise we would actually mailsplit on the in-body line). However, this has false positives if somebody actually has a commit body that starts with "From "; in this case we erroneously remove the line entirely from the commit message. We can make this check more robust by making sure the line actually looks like a real mbox "From" line. Inspect the line that begins with ">From " a more carefully to only skip lines that match the expected pattern (note that the datestamp part of the format-patch output is designed to be kept constant to help those who write magic(5) entries). Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- builtin/mailinfo.c | 17 ++++++++++++++++- t/t5100-mailinfo.sh | 18 ++++++++++++++++++ t/t5100/embed-from.expect | 5 +++++ t/t5100/embed-from.in | 13 +++++++++++++ t/t5100/quoted-from.expect | 3 +++ t/t5100/quoted-from.in | 10 ++++++++++ 6 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 t/t5100/embed-from.expect create mode 100644 t/t5100/embed-from.in create mode 100644 t/t5100/quoted-from.expect create mode 100644 t/t5100/quoted-from.in diff --git a/builtin/mailinfo.c b/builtin/mailinfo.c index cf11c8d6071dd7..2632fb037a6a28 100644 --- a/builtin/mailinfo.c +++ b/builtin/mailinfo.c @@ -288,6 +288,21 @@ static inline int cmp_header(const struct strbuf *line, const char *hdr) line->buf[len] == ':' && isspace(line->buf[len + 1]); } +#define SAMPLE "From e6807f3efca28b30decfecb1732a56c7db1137ee Mon Sep 17 00:00:00 2001\n" +static int is_format_patch_separator(const char *line, int len) +{ + const char *cp; + + if (len != strlen(SAMPLE)) + return 0; + if (!skip_prefix(line, "From ", &cp)) + return 0; + if (strspn(cp, "0123456789abcdef") != 40) + return 0; + cp += 40; + return !memcmp(SAMPLE + (cp - line), cp, strlen(SAMPLE) - (cp - line)); +} + static int check_header(const struct strbuf *line, struct strbuf *hdr_data[], int overwrite) { @@ -329,7 +344,7 @@ static int check_header(const struct strbuf *line, /* for inbody stuff */ if (starts_with(line->buf, ">From") && isspace(line->buf[5])) { - ret = 1; /* Should this return 0? */ + ret = is_format_patch_separator(line->buf + 1, line->len - 1); goto check_header_out; } if (starts_with(line->buf, "[PATCH]") && isspace(line->buf[7])) { diff --git a/t/t5100-mailinfo.sh b/t/t5100-mailinfo.sh index 3e64a7a65da864..9e1ad1ca21341d 100755 --- a/t/t5100-mailinfo.sh +++ b/t/t5100-mailinfo.sh @@ -89,4 +89,22 @@ test_expect_success 'mailinfo on from header without name works' ' ' +test_expect_success 'mailinfo finds headers after embedded From line' ' + mkdir embed-from && + git mailsplit -oembed-from "$TEST_DIRECTORY"/t5100/embed-from.in && + test_cmp "$TEST_DIRECTORY"/t5100/embed-from.in embed-from/0001 && + git mailinfo embed-from/msg embed-from/patch \ + embed-from/out && + test_cmp "$TEST_DIRECTORY"/t5100/embed-from.expect embed-from/out +' + +test_expect_success 'mailinfo on message with quoted >From' ' + mkdir quoted-from && + git mailsplit -oquoted-from "$TEST_DIRECTORY"/t5100/quoted-from.in && + test_cmp "$TEST_DIRECTORY"/t5100/quoted-from.in quoted-from/0001 && + git mailinfo quoted-from/msg quoted-from/patch \ + quoted-from/out && + test_cmp "$TEST_DIRECTORY"/t5100/quoted-from.expect quoted-from/msg +' + test_done diff --git a/t/t5100/embed-from.expect b/t/t5100/embed-from.expect new file mode 100644 index 00000000000000..06a3a3859a8aea --- /dev/null +++ b/t/t5100/embed-from.expect @@ -0,0 +1,5 @@ +Author: Commit Author +Email: commit@example.com +Subject: patch subject +Date: Sat, 13 Sep 2014 21:13:23 -0400 + diff --git a/t/t5100/embed-from.in b/t/t5100/embed-from.in new file mode 100644 index 00000000000000..5f3f84e508ff7d --- /dev/null +++ b/t/t5100/embed-from.in @@ -0,0 +1,13 @@ +From 1234567890123456789012345678901234567890 Mon Sep 17 00:00:00 2001 +From: Email Author +Date: Sun, 25 May 2008 00:38:18 -0700 +Subject: [PATCH] email subject + +>From 1234567890123456789012345678901234567890 Mon Sep 17 00:00:00 2001 +From: Commit Author +Date: Sat, 13 Sep 2014 21:13:23 -0400 +Subject: patch subject + +patch body +--- +patch diff --git a/t/t5100/quoted-from.expect b/t/t5100/quoted-from.expect new file mode 100644 index 00000000000000..8c9d48c8528572 --- /dev/null +++ b/t/t5100/quoted-from.expect @@ -0,0 +1,3 @@ +>From the depths of history, we are stuck with the +flaky mbox format. + diff --git a/t/t5100/quoted-from.in b/t/t5100/quoted-from.in new file mode 100644 index 00000000000000..847e1c4d3eaca3 --- /dev/null +++ b/t/t5100/quoted-from.in @@ -0,0 +1,10 @@ +From 1234567890123456789012345678901234567890 Mon Sep 17 00:00:00 2001 +From: Author Name +Date: Sun, 25 May 2008 00:38:18 -0700 +Subject: [PATCH] testing quoted >From + +>From the depths of history, we are stuck with the +flaky mbox format. + +--- +patch From 85de86a16bd853708658eb13689d913bc377ae3e Mon Sep 17 00:00:00 2001 From: Eric Sunshine Date: Sun, 21 Sep 2014 05:13:58 -0400 Subject: [PATCH 02/11] mailinfo: work around -Wstring-plus-int warning The just-released Apple Xcode 6.0.1 has -Wstring-plus-int enabled by default which complains about pointer arithmetic applied to a string literal: builtin/mailinfo.c:303:24: warning: adding 'long' to a string does not append to the string return !memcmp(SAMPLE + (cp - line), cp, strlen(SAMPLE) ... ~~~~~~~^~~~~~~~~~~~~ Signed-off-by: Eric Sunshine Signed-off-by: Junio C Hamano --- builtin/mailinfo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/builtin/mailinfo.c b/builtin/mailinfo.c index 2632fb037a6a28..6a14d2985d1239 100644 --- a/builtin/mailinfo.c +++ b/builtin/mailinfo.c @@ -288,9 +288,10 @@ static inline int cmp_header(const struct strbuf *line, const char *hdr) line->buf[len] == ':' && isspace(line->buf[len + 1]); } -#define SAMPLE "From e6807f3efca28b30decfecb1732a56c7db1137ee Mon Sep 17 00:00:00 2001\n" static int is_format_patch_separator(const char *line, int len) { + static const char SAMPLE[] = + "From e6807f3efca28b30decfecb1732a56c7db1137ee Mon Sep 17 00:00:00 2001\n"; const char *cp; if (len != strlen(SAMPLE)) From eb6c403500dd0b0d78b7b00d7ed0bf6b5daccc4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Wed, 1 Oct 2014 12:16:17 +0200 Subject: [PATCH 03/11] daemon: handle gethostbyname() error If the user-supplied hostname can't be found then we should not use it. We already avoid doing that in the non-NO_IPV6 case by checking if the return value of getaddrinfo() is zero (success). Do the same in the NO_IPV6 case and make sure the return value of gethostbyname() isn't NULL before dereferencing this pointer. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- daemon.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/daemon.c b/daemon.c index 13608c07c67417..25af533b97ec1e 100644 --- a/daemon.c +++ b/daemon.c @@ -579,20 +579,21 @@ static void parse_host_arg(char *extra_args, int buflen) static char addrbuf[HOST_NAME_MAX + 1]; hent = gethostbyname(hostname); + if (hent) { + ap = hent->h_addr_list; + memset(&sa, 0, sizeof sa); + sa.sin_family = hent->h_addrtype; + sa.sin_port = htons(0); + memcpy(&sa.sin_addr, *ap, hent->h_length); + + inet_ntop(hent->h_addrtype, &sa.sin_addr, + addrbuf, sizeof(addrbuf)); - ap = hent->h_addr_list; - memset(&sa, 0, sizeof sa); - sa.sin_family = hent->h_addrtype; - sa.sin_port = htons(0); - memcpy(&sa.sin_addr, *ap, hent->h_length); - - inet_ntop(hent->h_addrtype, &sa.sin_addr, - addrbuf, sizeof(addrbuf)); - - free(canon_hostname); - canon_hostname = xstrdup(hent->h_name); - free(ip_address); - ip_address = xstrdup(addrbuf); + free(canon_hostname); + canon_hostname = xstrdup(hent->h_name); + free(ip_address); + ip_address = xstrdup(addrbuf); + } #endif } } From 9d1b9aa9e10da398f430bc619b361d83bee6df7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Wed, 1 Oct 2014 12:18:15 +0200 Subject: [PATCH 04/11] daemon: fix error message after bind() Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- daemon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon.c b/daemon.c index 25af533b97ec1e..3be38f4dbcb0e9 100644 --- a/daemon.c +++ b/daemon.c @@ -950,7 +950,7 @@ static int setup_named_sock(char *listen_addr, int listen_port, struct socketlis } if ( bind(sockfd, (struct sockaddr *)&sin, sizeof sin) < 0 ) { - logerror("Could not listen to %s: %s", + logerror("Could not bind to %s: %s", ip2str(AF_INET, (struct sockaddr *)&sin, sizeof(sin)), strerror(errno)); close(sockfd); From 107efbeb2409ac3fb01560a42067c8cc506aa249 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Wed, 1 Oct 2014 12:21:57 +0200 Subject: [PATCH 05/11] daemon: remove write-only variable maxfd It became unused when 6573faff (NO_IPV6 support for git daemon) replaced select() with poll(). Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- daemon.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/daemon.c b/daemon.c index 3be38f4dbcb0e9..57b1a5783f0666 100644 --- a/daemon.c +++ b/daemon.c @@ -841,7 +841,6 @@ static const char *ip2str(int family, struct sockaddr *sin, socklen_t len) static int setup_named_sock(char *listen_addr, int listen_port, struct socketlist *socklist) { int socknum = 0; - int maxfd = -1; char pbuf[NI_MAXSERV]; struct addrinfo hints, *ai0, *ai; int gai; @@ -909,9 +908,6 @@ static int setup_named_sock(char *listen_addr, int listen_port, struct socketlis ALLOC_GROW(socklist->list, socklist->nr + 1, socklist->alloc); socklist->list[socklist->nr++] = sockfd; socknum++; - - if (maxfd < sockfd) - maxfd = sockfd; } freeaddrinfo(ai0); From eeff891ac756fd97a05476446f15269b714ce4cc Mon Sep 17 00:00:00 2001 From: Wieland Hoffmann Date: Sat, 4 Oct 2014 18:27:16 +0200 Subject: [PATCH 06/11] git-tag.txt: Add a missing hyphen to `-s` Signed-off-by: Wieland Hoffmann Signed-off-by: Junio C Hamano --- Documentation/git-tag.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/git-tag.txt b/Documentation/git-tag.txt index c418c44d40d149..a82d2e27bdd9c9 100644 --- a/Documentation/git-tag.txt +++ b/Documentation/git-tag.txt @@ -42,7 +42,7 @@ committer identity for the current user is used to find the GnuPG key for signing. The configuration variable `gpg.program` is used to specify custom GnuPG binary. -Tag objects (created with `-a`, `s`, or `-u`) are called "annotated" +Tag objects (created with `-a`, `-s`, or `-u`) are called "annotated" tags; they contain a creation date, the tagger name and e-mail, a tagging message, and an optional GnuPG signature. Whereas a "lightweight" tag is simply a name for an object (usually a commit From c30c43c07dc2f53d7a1b247813597e087313a518 Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Wed, 8 Oct 2014 20:46:10 +0000 Subject: [PATCH 07/11] Documentation: fix misrender of pretty-formats in Asciidoctor Neither the AsciiDoc nor the Asciidoctor documentation specify whether the same number of delimiter characters must be used to end a block as to begin it, although both sets of documentation show exactly matching pairs. AsciiDoc allows mismatches, but AsciiDoctor apparently does not. Adjust the pretty formats documentation to use matching pairs to prevent a misrendering where the remainder of the document was rendered as a listing block. Signed-off-by: brian m. carlson Signed-off-by: Junio C Hamano --- Documentation/pretty-formats.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt index d922e8e86c1734..d0723a93a07247 100644 --- a/Documentation/pretty-formats.txt +++ b/Documentation/pretty-formats.txt @@ -90,7 +90,7 @@ would show something like this: The author of fe6e0ee was Junio C Hamano, 23 hours ago The title was >>t4119: test autocomputing -p for traditional diff input.<< --------- +------- + The placeholders are: From b12d04503b0aba1f2d68b164b348cbf94bbe570b Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Wed, 15 Oct 2014 21:45:14 -0700 Subject: [PATCH 08/11] mergetools/meld: make usage of `--output` configurable and more robust Older versions of meld listed --output in `meld --help`. Newer versions only mention `meld [OPTIONS...]`. Improve the checks to catch these newer versions. Add a `mergetool.meld.hasOutput` configuration to allow overriding the heuristic. Reported-by: Andrey Novoseltsev Helped-by: Junio C Hamano Signed-off-by: David Aguilar Signed-off-by: Junio C Hamano --- Documentation/config.txt | 9 +++++++++ mergetools/meld | 9 +++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index c55c22ab7be94e..382e12c69efc52 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -1754,6 +1754,15 @@ mergetool..trustExitCode:: if the file has been updated, otherwise the user is prompted to indicate the success of the merge. +mergetool.meld.hasOutput:: + Older versions of `meld` do not support the `--output` option. + Git will attempt to detect whether `meld` supports `--output` + by inspecting the output of `meld --help`. Configuring + `mergetool.meld.hasOutput` will make Git skip these checks and + use the configured value instead. Setting `mergetool.meld.hasOutput` + to `true` tells Git to unconditionally use the `--output` option, + and `false` avoids using `--output`. + mergetool.keepBackup:: After performing a merge, the original file with conflict markers can be saved as a file with a `.orig` extension. If this variable diff --git a/mergetools/meld b/mergetools/meld index cb672a55192cb4..83ebdfb4c328ac 100644 --- a/mergetools/meld +++ b/mergetools/meld @@ -18,13 +18,18 @@ merge_cmd () { check_unchanged } -# Check whether 'meld --output ' is supported +# Check whether we should use 'meld --output ' check_meld_for_output_version () { meld_path="$(git config mergetool.meld.path)" meld_path="${meld_path:-meld}" - if "$meld_path" --help 2>&1 | grep -e --output >/dev/null + if meld_has_output_option=$(git config --bool mergetool.meld.hasOutput) then + : use configured value + elif "$meld_path" --help 2>&1 | + grep -e '--output=' -e '\[OPTION\.\.\.\]' >/dev/null + then + : old ones mention --output and new ones just say OPTION... meld_has_output_option=true else meld_has_output_option=false From 4750f4b962b4f09b03fcdde86684cf60c6f6e46a Mon Sep 17 00:00:00 2001 From: Roland Mas Date: Thu, 16 Oct 2014 08:54:47 +0200 Subject: [PATCH 09/11] gitweb: use start_form, not startform that was removed in CGI.pm 4.04 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CGI.pm 4.04 removed the startform method, which had previously been deprecated in favour of start_form. Changes file for CGI.pm says: 4.04 2014-09-04 [ REMOVED / DEPRECATIONS ] - startform and endform methods removed (previously deprecated, you should be using the start_form and end_form methods) Signed-off-by: Roland Mas Reviewed-by: Jakub Narębski Signed-off-by: Junio C Hamano --- gitweb/gitweb.perl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index a9f57d6f9024b2..ccf75169dd6fb5 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -4100,7 +4100,7 @@ sub print_search_form { if ($use_pathinfo) { $action .= "/".esc_url($project); } - print $cgi->startform(-method => "get", -action => $action) . + print $cgi->start_form(-method => "get", -action => $action) . "
\n" . (!$use_pathinfo && $cgi->input({-name=>"p", -value=>$project, -type=>"hidden"}) . "\n") . @@ -5510,7 +5510,7 @@ sub git_project_search_form { } print "
\n"; - print $cgi->startform(-method => 'get', -action => $my_uri) . + print $cgi->start_form(-method => 'get', -action => $my_uri) . $cgi->hidden(-name => 'a', -value => 'project_list') . "\n"; print $cgi->hidden(-name => 'pf', -value => $project_filter). "\n" if (defined $project_filter); From 21134714787a02a37da15424d72c0119b2b8ed71 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Thu, 16 Oct 2014 21:11:43 -0400 Subject: [PATCH 10/11] pack-objects: turn off bitmaps when we split packs If a pack.packSizeLimit is set, we may split the pack data across multiple packfiles. This means we cannot generate .bitmap files, as they require that all of the reachable objects are in the same pack. We check that condition when we are generating the list of objects to pack (and disable bitmaps if we are not packing everything), but we forgot to update it when we notice that we needed to split (which doesn't happen until the actual write phase). The resulting bitmaps are quite bogus (they mention entries that do not exist in the pack!) and can cause a fetch or push to send insufficient objects. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- builtin/pack-objects.c | 1 + t/t5310-pack-bitmaps.sh | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index de36c60ca11d24..a6c91fa0022220 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -812,6 +812,7 @@ static void write_pack_file(void) fixup_pack_header_footer(fd, sha1, pack_tmp_name, nr_written, sha1, offset); close(fd); + write_bitmap_index = 0; } if (!pack_to_stdout) { diff --git a/t/t5310-pack-bitmaps.sh b/t/t5310-pack-bitmaps.sh index f4f02ba918535d..2366fcffa77d3e 100755 --- a/t/t5310-pack-bitmaps.sh +++ b/t/t5310-pack-bitmaps.sh @@ -170,4 +170,13 @@ test_expect_success JGIT 'jgit can read our bitmaps' ' ) ' +test_expect_success 'splitting packs does not generate bogus bitmaps' ' + test-genrandom foo $((1024 * 1024)) >rand && + git add rand && + git commit -m "commit with big file" && + git -c pack.packSizeLimit=500k repack -adb && + git init --bare no-bitmaps.git && + git -C no-bitmaps.git fetch .. HEAD +' + test_done From 49c3e926349e964b311b46251bb2b97d3d669855 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 29 Oct 2014 10:48:38 -0700 Subject: [PATCH 11/11] Git 2.1.3 Signed-off-by: Junio C Hamano --- Documentation/RelNotes/2.1.3.txt | 26 ++++++++++++++++++++++++++ Documentation/git.txt | 3 ++- GIT-VERSION-GEN | 2 +- RelNotes | 2 +- 4 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 Documentation/RelNotes/2.1.3.txt diff --git a/Documentation/RelNotes/2.1.3.txt b/Documentation/RelNotes/2.1.3.txt new file mode 100644 index 00000000000000..acc9ebb886ea59 --- /dev/null +++ b/Documentation/RelNotes/2.1.3.txt @@ -0,0 +1,26 @@ +Git v2.1.3 Release Notes +======================== + + * Some MUAs mangled a line in a message that begins with "From " to + ">From " when writing to a mailbox file and feeding such an input to + "git am" used to lose such a line. + + * "git daemon" (with NO_IPV6 build configuration) used to incorrectly + use the hostname even when gethostbyname() reported that the given + hostname is not found. + + * Newer versions of 'meld' breaks the auto-detection we use to see if + they are new enough to support the `--output` option. + + * "git pack-objects" forgot to disable the codepath to generate + object recheability bitmap when it needs to split the resulting + pack. + + * "gitweb" used deprecated CGI::startfrom, which was removed from + CGI.pm as of 4.04; use CGI::start_from instead. + + * "git log" documentation had an example section marked up not + quite correctly, which passed AsciiDoc but failed with + AsciiDoctor. + +Also contains some documentation updates. diff --git a/Documentation/git.txt b/Documentation/git.txt index c6175d45e4257e..56278451140b49 100644 --- a/Documentation/git.txt +++ b/Documentation/git.txt @@ -43,9 +43,10 @@ unreleased) version of Git, that is available from the 'master' branch of the `git.git` repository. Documentation for older releases are available here: -* link:v2.1.2/git.html[documentation for release 2.1.2] +* link:v2.1.3/git.html[documentation for release 2.1.3] * release notes for + link:RelNotes/2.1.3.txt[2.1.3], link:RelNotes/2.1.2.txt[2.1.2], link:RelNotes/2.1.1.txt[2.1.1], link:RelNotes/2.1.0.txt[2.1]. diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 14b866e9b31817..b0500c22ddc1ff 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -1,7 +1,7 @@ #!/bin/sh GVF=GIT-VERSION-FILE -DEF_VER=v2.1.2 +DEF_VER=v2.1.3 LF=' ' diff --git a/RelNotes b/RelNotes index f2706be6c1253c..192f48cc9470b1 120000 --- a/RelNotes +++ b/RelNotes @@ -1 +1 @@ -Documentation/RelNotes/2.1.2.txt \ No newline at end of file +Documentation/RelNotes/2.1.3.txt \ No newline at end of file