aboutsummaryrefslogtreecommitdiff
path: root/diff-cache.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-06-03 01:37:54 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-03 11:23:03 -0700
commit0e3994fa97e9876b571531444b97ae6e63fd744d (patch)
treef8ff146064f56528bc09efc7eafcc59f61fb344d /diff-cache.c
parentce24067549a8554b214e723d7aa4bc063c54409e (diff)
downloadgit-0e3994fa97e9876b571531444b97ae6e63fd744d.tar.gz
git-0e3994fa97e9876b571531444b97ae6e63fd744d.tar.xz
[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>
Diffstat (limited to 'diff-cache.c')
-rw-r--r--diff-cache.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/diff-cache.c b/diff-cache.c
index 8e5f72bf3..e95fd70da 100644
--- a/diff-cache.c
+++ b/diff-cache.c
@@ -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")) {