Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Sunshine <sunshine@sunshineco.com>2013-08-06 17:59:49 +0400
committerJunio C Hamano <gitster@pobox.com>2013-08-07 01:48:55 +0400
commit5ce922a014f78684a96c3d03a51decf0d21fa58d (patch)
tree51a30c2cf9e291ff7ca739b1e19cd28d0bc67b7b /line-range.c
parent9527604f7d6490fd4ce0809fe8fc8a600e03710d (diff)
line-range: reject -L line numbers less than 1
Since inception, git-blame -L has been documented as accepting 1-based line numbers. When handed a line number less than 1, -L's behavior is undocumented and undefined; it's also nonsensical and should be diagnosed as an error. Do so. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'line-range.c')
-rw-r--r--line-range.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/line-range.c b/line-range.c
index ede0c6c98f..de4e32f942 100644
--- a/line-range.c
+++ b/line-range.c
@@ -54,8 +54,11 @@ static const char *parse_loc(const char *spec, nth_line_fn_t nth_line,
}
num = strtol(spec, &term, 10);
if (term != spec) {
- if (ret)
+ if (ret) {
+ if (num <= 0)
+ die("-L invalid line number: %ld", num);
*ret = num;
+ }
return term;
}