From: Junio C Hamano Date: Mon, 23 May 2016 21:54:31 +0000 (-0700) Subject: Merge branch 'pb/commit-verbose-config' X-Git-Tag: v2.9.0-rc0~9 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/5d5f1c236b63596a59293a893d914dab1c8dd377?ds=inline;hp=--cc Merge branch 'pb/commit-verbose-config' "git commit" learned to pay attention to "commit.verbose" configuration variable and act as if "--verbose" option was given from the command line. * pb/commit-verbose-config: commit: add a commit.verbose config variable t7507-commit-verbose: improve test coverage by testing number of diffs parse-options.c: make OPTION_COUNTUP respect "unspecified" values t/t7507: improve test coverage t0040-parse-options: improve test coverage test-parse-options: print quiet as integer t0040-test-parse-options.sh: fix style issues --- 5d5f1c236b63596a59293a893d914dab1c8dd377 diff --cc Documentation/config.txt index ea928a729f,8bf60409f7..53f00dbc26 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@@ -1138,9 -1106,14 +1138,13 @@@ commit.status: message. Defaults to true. commit.template:: - Specify a file to use as the template for new commit messages. - "`~/`" is expanded to the value of `$HOME` and "`~user/`" to the - specified user's home directory. + Specify the pathname of a file to use as the template for + new commit messages. + commit.verbose:: + A boolean or int to specify the level of verbose with `git commit`. + See linkgit:git-commit[1]. + credential.helper:: Specify an external helper to be called when a username or password credential is needed; the helper may consult external diff --cc t/helper/test-parse-options.c index 2c8c8f18ed,0000000000..f02c275f33 mode 100644,000000..100644 --- a/t/helper/test-parse-options.c +++ b/t/helper/test-parse-options.c @@@ -1,104 -1,0 +1,105 @@@ +#include "cache.h" +#include "parse-options.h" +#include "string-list.h" + +static int boolean = 0; +static int integer = 0; +static unsigned long magnitude = 0; +static unsigned long timestamp; +static int abbrev = 7; - static int verbose = 0, dry_run = 0, quiet = 0; ++static int verbose = -1; /* unspecified */ ++static int dry_run = 0, quiet = 0; +static char *string = NULL; +static char *file = NULL; +static int ambiguous; +static struct string_list list; + +static int length_callback(const struct option *opt, const char *arg, int unset) +{ + printf("Callback: \"%s\", %d\n", + (arg ? arg : "not set"), unset); + if (unset) + return 1; /* do not support unset */ + + *(int *)opt->value = strlen(arg); + return 0; +} + +static int number_callback(const struct option *opt, const char *arg, int unset) +{ + *(int *)opt->value = strtol(arg, NULL, 10); + return 0; +} + +int main(int argc, char **argv) +{ + const char *prefix = "prefix/"; + const char *usage[] = { + "test-parse-options ", + NULL + }; + struct option options[] = { + OPT_BOOL(0, "yes", &boolean, "get a boolean"), + OPT_BOOL('D', "no-doubt", &boolean, "begins with 'no-'"), + { OPTION_SET_INT, 'B', "no-fear", &boolean, NULL, + "be brave", PARSE_OPT_NOARG | PARSE_OPT_NONEG, NULL, 1 }, + OPT_COUNTUP('b', "boolean", &boolean, "increment by one"), + OPT_BIT('4', "or4", &boolean, + "bitwise-or boolean with ...0100", 4), + OPT_NEGBIT(0, "neg-or4", &boolean, "same as --no-or4", 4), + OPT_GROUP(""), + OPT_INTEGER('i', "integer", &integer, "get a integer"), + OPT_INTEGER('j', NULL, &integer, "get a integer, too"), + OPT_MAGNITUDE('m', "magnitude", &magnitude, "get a magnitude"), + OPT_SET_INT(0, "set23", &integer, "set integer to 23", 23), + OPT_DATE('t', NULL, ×tamp, "get timestamp of