@ -56,6 +56,11 @@ static char diff_colors[][COLOR_MAXLEN] = {
GIT_COLOR_NORMAL, /* FUNCINFO */
GIT_COLOR_NORMAL, /* FUNCINFO */
};
};
static NORETURN void die_want_option(const char *option_name)
{
die(_("option '%s' requires a value"), option_name);
}
static int parse_diff_color_slot(const char *var)
static int parse_diff_color_slot(const char *var)
{
{
if (!strcasecmp(var, "context") || !strcasecmp(var, "plain"))
if (!strcasecmp(var, "context") || !strcasecmp(var, "plain"))
@ -3341,7 +3346,7 @@ void diff_setup_done(struct diff_options *options)
if (options->output_format & DIFF_FORMAT_NO_OUTPUT)
if (options->output_format & DIFF_FORMAT_NO_OUTPUT)
count++;
count++;
if (count > 1)
if (count > 1)
die("--name-only, --name-status, --check and -s are mutually exclusive");
die(_("--name-only, --name-status, --check and -s are mutually exclusive"));
/*
/*
* Most of the time we can say "there are changes"
* Most of the time we can say "there are changes"
@ -3537,7 +3542,7 @@ static int stat_opt(struct diff_options *options, const char **av)
if (*arg == '=')
if (*arg == '=')
width = strtoul(arg + 1, &end, 10);
width = strtoul(arg + 1, &end, 10);
else if (!*arg && !av[1])
else if (!*arg && !av[1])
die("Option '--stat-width' requires a value");
die_want_option("--stat-width");
else if (!*arg) {
else if (!*arg) {
width = strtoul(av[1], &end, 10);
width = strtoul(av[1], &end, 10);
argcount = 2;
argcount = 2;
@ -3546,7 +3551,7 @@ static int stat_opt(struct diff_options *options, const char **av)
if (*arg == '=')
if (*arg == '=')
name_width = strtoul(arg + 1, &end, 10);
name_width = strtoul(arg + 1, &end, 10);
else if (!*arg && !av[1])
else if (!*arg && !av[1])
die("Option '--stat-name-width' requires a value");
die_want_option("--stat-name-width");
else if (!*arg) {
else if (!*arg) {
name_width = strtoul(av[1], &end, 10);
name_width = strtoul(av[1], &end, 10);
argcount = 2;
argcount = 2;
@ -3555,7 +3560,7 @@ static int stat_opt(struct diff_options *options, const char **av)
if (*arg == '=')
if (*arg == '=')
graph_width = strtoul(arg + 1, &end, 10);
graph_width = strtoul(arg + 1, &end, 10);
else if (!*arg && !av[1])
else if (!*arg && !av[1])
die("Option '--stat-graph-width' requires a value");
die_want_option("--stat-graph-width");
else if (!*arg) {
else if (!*arg) {
graph_width = strtoul(av[1], &end, 10);
graph_width = strtoul(av[1], &end, 10);
argcount = 2;
argcount = 2;
@ -3564,7 +3569,7 @@ static int stat_opt(struct diff_options *options, const char **av)
if (*arg == '=')
if (*arg == '=')
count = strtoul(arg + 1, &end, 10);
count = strtoul(arg + 1, &end, 10);
else if (!*arg && !av[1])
else if (!*arg && !av[1])
die("Option '--stat-count' requires a value");
die_want_option("--stat-count");
else if (!*arg) {
else if (!*arg) {
count = strtoul(av[1], &end, 10);
count = strtoul(av[1], &end, 10);
argcount = 2;
argcount = 2;