Andrew's git
/
gitweb.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
commit
grep
author
committer
pickaxe
?
re
line-range: teach -L^/RE/ to search from start of file
[gitweb.git]
/
line-range.c
diff --git
a/line-range.c
b/line-range.c
index bbf3c0f4481e9dd762d6a55e531cb983bbcbaff1..70484899aca0592de3f08e31ca05d9d668ccb7ff 100644
(file)
--- a/
line-range.c
+++ b/
line-range.c
@@
-59,8
+59,14
@@
static const char *parse_loc(const char *spec, nth_line_fn_t nth_line,
return term;
}
- if (begin < 0)
- begin = -begin;
+ if (begin < 0) {
+ if (spec[0] != '^')
+ begin = -begin;
+ else {
+ begin = 1;
+ spec++;
+ }
+ }
if (spec[0] != '/')
return spec;