summaryrefslogtreecommitdiff
path: root/diff-files.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-06-03 08:37:54 (GMT)
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-03 18:23:03 (GMT)
commit0e3994fa97e9876b571531444b97ae6e63fd744d (patch)
treef8ff146064f56528bc09efc7eafcc59f61fb344d /diff-files.c
parentce24067549a8554b214e723d7aa4bc063c54409e (diff)
downloadgit-0e3994fa97e9876b571531444b97ae6e63fd744d.zip
git-0e3994fa97e9876b571531444b97ae6e63fd744d.tar.gz
git-0e3994fa97e9876b571531444b97ae6e63fd744d.tar.bz2
[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-files.c')
-rw-r--r--diff-files.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/diff-files.c b/diff-files.c
index a425112..5c895cc 100644
--- a/diff-files.c
+++ b/diff-files.c
@@ -61,14 +61,21 @@ int main(int argc, const char **argv)
orderfile = argv[1] + 2;
else if (!strcmp(argv[1], "--pickaxe-all"))
pickaxe_opts = DIFF_PICKAXE_ALL;
- else if (!strncmp(argv[1], "-B", 2))
- diff_break_opt = diff_scoreopt_parse(argv[1]);
+ else if (!strncmp(argv[1], "-B", 2)) {
+ if ((diff_break_opt =
+ diff_scoreopt_parse(argv[1])) == -1)
+ usage(diff_files_usage);
+ }
else if (!strncmp(argv[1], "-M", 2)) {
- diff_score_opt = diff_scoreopt_parse(argv[1]);
+ if ((diff_score_opt =
+ diff_scoreopt_parse(argv[1])) == -1)
+ usage(diff_files_usage);
detect_rename = DIFF_DETECT_RENAME;
}
else if (!strncmp(argv[1], "-C", 2)) {
- diff_score_opt = diff_scoreopt_parse(argv[1]);
+ if ((diff_score_opt =
+ diff_scoreopt_parse(argv[1])) == -1)
+ usage(diff_files_usage);
detect_rename = DIFF_DETECT_COPY;
}
else