diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-11-18 09:23:53 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-11-18 09:23:53 (GMT) |
commit | ab96f28ba4deb71ff64b31bd63cee96314db7112 (patch) | |
tree | 16ad5cafd201b65eb74c0c132f08b5ecc852fd92 /t | |
parent | fa2f2f085ed8999b799d48e652f9e438571e8491 (diff) | |
parent | 61b0fcbb64d00d52290d433c1e754c01740b3d19 (diff) | |
download | git-ab96f28ba4deb71ff64b31bd63cee96314db7112.zip git-ab96f28ba4deb71ff64b31bd63cee96314db7112.tar.gz git-ab96f28ba4deb71ff64b31bd63cee96314db7112.tar.bz2 |
Merge branch 'jk/unused-parameter-fixes'
Various functions have been audited for "-Wunused-parameter" warnings
and bugs in them got fixed.
* jk/unused-parameter-fixes:
midx: double-check large object write loop
assert NOARG/NONEG behavior of parse-options callbacks
parse-options: drop OPT_DATE()
apply: return -1 from option callback instead of calling exit(1)
cat-file: report an error on multiple --batch options
tag: mark "--message" option with NONEG
show-branch: mark --reflog option as NONEG
format-patch: mark "--no-numbered" option with NONEG
status: mark --find-renames option with NONEG
cat-file: mark batch options with NONEG
pack-objects: mark index-version option as NONEG
ls-files: mark exclude options as NONEG
am: handle --no-patch-format option
apply: mark include/exclude options as NONEG
Diffstat (limited to 't')
-rw-r--r-- | t/helper/test-parse-options.c | 2 | ||||
-rwxr-xr-x | t/t0040-parse-options.sh | 22 |
2 files changed, 1 insertions, 23 deletions
diff --git a/t/helper/test-parse-options.c b/t/helper/test-parse-options.c index 9cb8a0e..47fee66 100644 --- a/t/helper/test-parse-options.c +++ b/t/helper/test-parse-options.c @@ -36,6 +36,7 @@ static int length_callback(const struct option *opt, const char *arg, int unset) static int number_callback(const struct option *opt, const char *arg, int unset) { + BUG_ON_OPT_NEG(unset); *(int *)opt->value = strtol(arg, NULL, 10); return 0; } @@ -119,7 +120,6 @@ int cmd__parse_options(int argc, const char **argv) 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 <time>"), OPT_CALLBACK('L', "length", &integer, "str", "get length of <str>", length_callback), OPT_FILENAME('F', "file", &file, "set file to <file>"), diff --git a/t/t0040-parse-options.sh b/t/t0040-parse-options.sh index 17d0c18..f5b1086 100755 --- a/t/t0040-parse-options.sh +++ b/t/t0040-parse-options.sh @@ -23,7 +23,6 @@ usage: test-tool parse-options <options> -j <n> get a integer, too -m, --magnitude <n> get a magnitude --set23 set integer to 23 - -t <time> get timestamp of <time> -L, --length <str> get length of <str> -F, --file <file> set file to <file> @@ -246,27 +245,6 @@ test_expect_success 'keep some options as arguments' ' ' cat >expect <<\EOF -boolean: 0 -integer: 0 -magnitude: 0 -timestamp: 1 -string: (not set) -abbrev: 7 -verbose: -1 -quiet: 1 -dry run: no -file: (not set) -arg 00: foo -EOF - -test_expect_success 'OPT_DATE() works' ' - test-tool parse-options -t "1970-01-01 00:00:01 +0000" \ - foo -q >output 2>output.err && - test_must_be_empty output.err && - test_cmp expect output -' - -cat >expect <<\EOF Callback: "four", 0 boolean: 5 integer: 4 |