[PATCH] diff: Clean up diff_scoreopt_parse().

This cleans up diff_scoreopt_parse() function that is used to
parse the fractional notation -B, -C and -M option takes.  The
callers are modified to check for errors and complain.  Earlier
they silently ignored malformed input and falled back on the
default.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Junio C Hamano
2005-06-03 01:37:54 -07:00
committed by Linus Torvalds
parent ce24067549
commit 0e3994fa97
5 changed files with 62 additions and 28 deletions

View File

@ -191,17 +191,20 @@ int main(int argc, const char **argv)
continue;
}
if (!strncmp(arg, "-B", 2)) {
diff_break_opt = diff_scoreopt_parse(arg);
if ((diff_break_opt = diff_scoreopt_parse(arg)) == -1)
usage(diff_cache_usage);
continue;
}
if (!strncmp(arg, "-M", 2)) {
detect_rename = DIFF_DETECT_RENAME;
diff_score_opt = diff_scoreopt_parse(arg);
if ((diff_score_opt = diff_scoreopt_parse(arg)) == -1)
usage(diff_cache_usage);
continue;
}
if (!strncmp(arg, "-C", 2)) {
detect_rename = DIFF_DETECT_COPY;
diff_score_opt = diff_scoreopt_parse(arg);
if ((diff_score_opt = diff_scoreopt_parse(arg)) == -1)
usage(diff_cache_usage);
continue;
}
if (!strcmp(arg, "-z")) {