diff options
author | Eric Sunshine <sunshine@sunshineco.com> | 2013-08-06 09:59:41 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-08-06 14:36:34 -0700 |
commit | 815834e9aa6148b7815b9aea7db5d44640a4383a (patch) | |
tree | 50eef3bf1d19e4822beb68215a02276b993c86ae /line-range.h | |
parent | 5bd9b79a2017daad1d600978b75c714eef74cac0 (diff) | |
download | git-815834e9aa6148b7815b9aea7db5d44640a4383a.tar.gz |
line-range: teach -L/RE/ to search relative to anchor point
Range specification -L/RE/ for blame/log unconditionally begins
searching at line one. Mailing list discussion [1] suggests that, in the
presence of multiple -L options, -L/RE/ should search relative to the
endpoint of the previous -L range, if any.
Teach the parsing machinery underlying blame's and log's -L options to
accept a start point for -L/RE/ searches. Follow-up patches will upgrade
blame and log to take advantage of this ability.
[1]: http://thread.gmane.org/gmane.comp.version-control.git/229755/focus=229966
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'line-range.h')
-rw-r--r-- | line-range.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/line-range.h b/line-range.h index ae3d0123b4..83ba3c25e8 100644 --- a/line-range.h +++ b/line-range.h @@ -9,6 +9,9 @@ * line 'lno' inside the 'cb_data'. The caller is expected to already * have a suitable map at hand to make this a constant-time lookup. * + * 'anchor' is the 1-based line at which relative range specifications + * should be anchored. Absolute ranges are unaffected by this value. + * * Returns 0 in case of success and -1 if there was an error. The * actual range is stored in *begin and *end. The counting starts * at 1! In case of error, the caller should show usage message. @@ -18,7 +21,7 @@ typedef const char *(*nth_line_fn_t)(void *data, long lno); extern int parse_range_arg(const char *arg, nth_line_fn_t nth_line_cb, - void *cb_data, long lines, + void *cb_data, long lines, long anchor, long *begin, long *end, const char *path); |