test-lib: whitelist GIT_TR2_* in the environment
[gitweb.git] / t / helper / test-parse-options.c
index 9cb8a0ea0f8ae7b3da8525b2a354bfa542db93c3..cc88fba05752cbf67c2669c219cc0a65d4a354ee 100644 (file)
@@ -2,6 +2,7 @@
 #include "cache.h"
 #include "parse-options.h"
 #include "string-list.h"
+#include "trace2.h"
 
 static int boolean = 0;
 static int integer = 0;
@@ -36,6 +37,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 +121,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, &timestamp, "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>"),
@@ -153,6 +154,8 @@ int cmd__parse_options(int argc, const char **argv)
        int i;
        int ret = 0;
 
+       trace2_cmd_name("_parse_");
+
        argc = parse_options(argc, (const char **)argv, prefix, options, usage, 0);
 
        if (length_cb.called) {