Merge branch 'jn/parse-config-slot' into jk/colors
authorJunio C Hamano <gitster@pobox.com>
Thu, 20 Nov 2014 19:40:29 +0000 (11:40 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 20 Nov 2014 19:40:29 +0000 (11:40 -0800)
* jn/parse-config-slot:
color_parse: do not mention variable name in error message
pass config slots as pointers instead of offsets

23 files changed:
Documentation/RelNotes/2.1.3.txt [new file with mode: 0644]
Documentation/config.txt
Documentation/git-credential-store.txt
Documentation/git-tag.txt
Documentation/git.txt
Documentation/gitignore.txt
Documentation/pretty-formats.txt
GIT-VERSION-GEN
RelNotes
builtin/clean.c
builtin/config.c
builtin/mailinfo.c
builtin/pack-objects.c
daemon.c
gitweb/gitweb.perl
mergetools/meld
t/t4026-color.sh
t/t5100-mailinfo.sh
t/t5100/embed-from.expect [new file with mode: 0644]
t/t5100/embed-from.in [new file with mode: 0644]
t/t5100/quoted-from.expect [new file with mode: 0644]
t/t5100/quoted-from.in [new file with mode: 0644]
t/t5310-pack-bitmaps.sh
diff --git a/Documentation/RelNotes/2.1.3.txt b/Documentation/RelNotes/2.1.3.txt
new file mode 100644 (file)
index 0000000..acc9ebb
--- /dev/null
@@ -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.
index c55c22ab7be94e798164a48622aca21dd4daa44f..9678ab6aa8ee846dabca72bb413820584aaabfe2 100644 (file)
@@ -669,7 +669,7 @@ alias.*::
        confusion and troubles with script usage, aliases that
        hide existing Git commands are ignored. Arguments are split by
        spaces, the usual shell quoting and escaping is supported.
-       quote pair and a backslash can be used to quote them.
+       A quote pair or a backslash can be used to quote them.
 +
 If the alias expansion is prefixed with an exclamation point,
 it will be treated as a shell command.  For example, defining
@@ -825,6 +825,10 @@ accepted are `normal`, `black`, `red`, `green`, `yellow`, `blue`,
 `blink` and `reverse`.  The first color given is the foreground; the
 second is the background.  The position of the attribute, if any,
 doesn't matter.
++
+Colors (foreground and background) may also be given as numbers between
+0 and 255; these use ANSI 256-color mode (but note that not all
+terminals may support this).
 
 color.diff::
        Whether to use ANSI escape sequences to add color to patches.
@@ -1754,6 +1758,15 @@ mergetool.<tool>.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
@@ -2286,7 +2299,7 @@ status.showUntrackedFiles::
        files which are not currently tracked by Git. Directories which
        contain only untracked files, are shown with the directory name
        only. Showing untracked files means that Git needs to lstat() all
-       all the files in the whole repository, which might be slow on some
+       the files in the whole repository, which might be slow on some
        systems. So, this variable controls how the commands displays
        the untracked files. Possible values are:
 +
index 8481cae70ef067bafbee82c9c720795b09881024..bc97071e7668ac48d07065190e88d1ce74822041 100644 (file)
@@ -29,7 +29,7 @@ linkgit:gitcredentials[7] or `EXAMPLES` below.
 OPTIONS
 -------
 
---store=<path>::
+--file=<path>::
 
        Use `<path>` to store credentials. The file will have its
        filesystem permissions set to prevent other users on the system
index 320908369f067f5d494c6bc0c3c9f28fa26859a6..e953ba4439f5995c797b4d7ad869847a5479d982 100644 (file)
@@ -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
index c6175d45e4257efa96995853f00e42baf4b221f9..56278451140b49fa13332ebf74f58a6713df2c26 100644 (file)
@@ -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].
index 8734c1566ca918e8c62f759aebdf7d0b497e860b..09e82c31bd320a162689a7f2d919de439d05375a 100644 (file)
@@ -77,7 +77,7 @@ PATTERN FORMAT
    Put a backslash ("`\`") in front of the first hash for patterns
    that begin with a hash.
 
- - Trailing spaces are ignored unless they are quoted with backlash
+ - Trailing spaces are ignored unless they are quoted with backslash
    ("`\`").
 
  - An optional prefix "`!`" which negates the pattern; any
index 85d63532a3e165110717ca2602e9dd806f10bd9f..b87784d29ea36b7f4c902475f032c64b04715575 100644 (file)
@@ -95,7 +95,7 @@ would show something like this:
 The author of fe6e0ee was Junio C Hamano, 23 hours ago
 The title was >>t4119: test autocomputing -p<n> for traditional diff input.<<
 
---------
+-------
 +
 The placeholders are:
 
index 14b866e9b318178b7a820a5a383c2fe01672f11c..b0500c22ddc1fff55cb99a36ab34e45d200a4c42 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 GVF=GIT-VERSION-FILE
-DEF_VER=v2.1.2
+DEF_VER=v2.1.3
 
 LF='
 '
index f2706be6c1253c8e902badc8d01f58381e0c05b6..192f48cc9470b11e01edda4f0a84a257480ca96c 120000 (symlink)
--- 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
index 035ea391a2ec0c9399fa9868888d32e84c93b227..a7e7b0bf6abc0d9d662ab99273dc1c2a86f26698 100644 (file)
@@ -67,7 +67,7 @@ struct menu_item {
        char hotkey;
        const char *title;
        int selected;
-       int (*fn)();
+       int (*fn)(void);
 };
 
 enum menu_stuff_type {
index 842809b0b3b0907a883d651a72891a071367ab9e..d11105d9070c9aaf4c5170715a4a53ce091dc094 100644 (file)
@@ -69,8 +69,8 @@ static struct option builtin_config_options[] = {
        OPT_BIT(0, "remove-section", &actions, N_("remove a section: name"), ACTION_REMOVE_SECTION),
        OPT_BIT('l', "list", &actions, N_("list all"), ACTION_LIST),
        OPT_BIT('e', "edit", &actions, N_("open an editor"), ACTION_EDIT),
-       OPT_STRING(0, "get-color", &get_color_slot, N_("slot"), N_("find the color configured: [default]")),
-       OPT_STRING(0, "get-colorbool", &get_colorbool_slot, N_("slot"), N_("find the color setting: [stdout-is-tty]")),
+       OPT_BIT(0, "get-color", &actions, N_("find the color configured: slot [default]"), ACTION_GET_COLOR),
+       OPT_BIT(0, "get-colorbool", &actions, N_("find the color setting: slot [stdout-is-tty]"), ACTION_GET_COLORBOOL),
        OPT_GROUP(N_("Type")),
        OPT_BIT(0, "bool", &types, N_("value is \"true\" or \"false\""), TYPE_BOOL),
        OPT_BIT(0, "int", &types, N_("value is decimal number"), TYPE_INT),
@@ -303,8 +303,9 @@ static int git_get_color_config(const char *var, const char *value, void *cb)
        return 0;
 }
 
-static void get_color(const char *def_color)
+static void get_color(const char *var, const char *def_color)
 {
+       get_color_slot = var;
        get_color_found = 0;
        parsed_color[0] = '\0';
        git_config_with_options(git_get_color_config, NULL,
@@ -333,8 +334,9 @@ static int git_get_colorbool_config(const char *var, const char *value,
        return 0;
 }
 
-static int get_colorbool(int print)
+static int get_colorbool(const char *var, int print)
 {
+       get_colorbool_slot = var;
        get_colorbool_found = -1;
        get_diff_color_found = -1;
        get_color_ui_found = -1;
@@ -518,12 +520,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
                usage_with_options(builtin_config_usage, builtin_config_options);
        }
 
-       if (get_color_slot)
-           actions |= ACTION_GET_COLOR;
-       if (get_colorbool_slot)
-           actions |= ACTION_GET_COLORBOOL;
-
-       if ((get_color_slot || get_colorbool_slot) && types) {
+       if ((actions & (ACTION_GET_COLOR|ACTION_GET_COLORBOOL)) && types) {
                error("--get-color and variable type are incoherent");
                usage_with_options(builtin_config_usage, builtin_config_options);
        }
@@ -658,12 +655,14 @@ int cmd_config(int argc, const char **argv, const char *prefix)
                        die("No such section!");
        }
        else if (actions == ACTION_GET_COLOR) {
-               get_color(argv[0]);
+               check_argc(argc, 1, 2);
+               get_color(argv[0], argv[1]);
        }
        else if (actions == ACTION_GET_COLORBOOL) {
-               if (argc == 1)
-                       color_stdout_is_tty = git_config_bool("command line", argv[0]);
-               return get_colorbool(argc != 0);
+               check_argc(argc, 1, 2);
+               if (argc == 2)
+                       color_stdout_is_tty = git_config_bool("command line", argv[1]);
+               return get_colorbool(argv[0], argc == 2);
        }
 
        return 0;
index cf11c8d6071dd791508d3bd5f46d30550765a90f..6a14d2985d12394d343cb91290111d6a8c0a5d06 100644 (file)
@@ -288,6 +288,22 @@ static inline int cmp_header(const struct strbuf *line, const char *hdr)
                        line->buf[len] == ':' && isspace(line->buf[len + 1]);
 }
 
+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))
+               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 +345,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])) {
index b59f5d895e38bdb96d19b5fc5061669facdf22cc..3eb86e0693b3f9adb6680645151f842dffa7a4f9 100644 (file)
@@ -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) {
index e6b51ed9981f2e4084504a2a092a3f28fc7d4c8a..4b0218457610fe994bec256d51b9c01f368383ea 100644 (file)
--- a/daemon.c
+++ b/daemon.c
@@ -573,20 +573,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
        }
 }
@@ -834,7 +835,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;
@@ -902,9 +902,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);
@@ -943,7 +940,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);
index a9f57d6f9024b2c23d6a2a67d33d84638e3bfb07..ccf75169dd6fb50e2f8ce584af8fa7841fa55fd6 100755 (executable)
@@ -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) .
              "<div class=\"search\">\n" .
              (!$use_pathinfo &&
              $cgi->input({-name=>"p", -value=>$project, -type=>"hidden"}) . "\n") .
@@ -5510,7 +5510,7 @@ sub git_project_search_form {
        }
 
        print "<div class=\"projsearch\">\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);
index cb672a55192cb44335aa2cbe1f10004bb26d86ff..83ebdfb4c328ac79af38bfe935f0dbfa7fb6f53b 100644 (file)
@@ -18,13 +18,18 @@ merge_cmd () {
        check_unchanged
 }
 
-# Check whether 'meld --output <file>' is supported
+# Check whether we should use 'meld --output <file>'
 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
index 3726a0e2012e534623ddbdd71da04f177c32d4d0..63e423838f1025d74b830bf84629427defdb756a 100755 (executable)
@@ -53,6 +53,14 @@ test_expect_success '256 colors' '
        color "254 bold 255" "[1;38;5;254;48;5;255m"
 '
 
+test_expect_success '"normal" yields no color at all"' '
+       color "normal black" "[40m"
+'
+
+test_expect_success '-1 is a synonym for "normal"' '
+       color "-1 black" "[40m"
+'
+
 test_expect_success 'color too small' '
        invalid_color "-2"
 '
index 3e64a7a65da86410dd0236975bef9bd0013a6405..9e1ad1ca21341d449fa3ab1b896a899e51272127 100755 (executable)
@@ -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/0001 >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/0001 >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 (file)
index 0000000..06a3a38
--- /dev/null
@@ -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 (file)
index 0000000..5f3f84e
--- /dev/null
@@ -0,0 +1,13 @@
+From 1234567890123456789012345678901234567890 Mon Sep 17 00:00:00 2001
+From: Email Author <email@example.com>
+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 <commit@example.com>
+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 (file)
index 0000000..8c9d48c
--- /dev/null
@@ -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 (file)
index 0000000..847e1c4
--- /dev/null
@@ -0,0 +1,10 @@
+From 1234567890123456789012345678901234567890 Mon Sep 17 00:00:00 2001
+From: Author Name <somebody@example.com>
+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
index 0580258c91a07aabe2773cce04df47d3c183b425..6003490192880802d866ec3788facaf4dcf17147 100755 (executable)
@@ -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