diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-06-02 16:00:44 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-06-02 16:00:44 -0700 |
commit | ed73fe56428eecd2b635473f6a517a183c4713a3 (patch) | |
tree | 42b21a016eca79cfee341a1bc0dbf5118acdb01e /line-range.h | |
parent | 4de1179afcb1105a43cf167b513afda42c4f152d (diff) | |
parent | 499926670665570d785bc7baca4d7cd4420823dc (diff) | |
download | git-ed73fe56428eecd2b635473f6a517a183c4713a3.tar.gz |
Merge branch 'tr/line-log'
* tr/line-log:
git-log(1): remove --full-line-diff description
line-log: fix documentation formatting
log -L: improve comments in process_all_files()
log -L: store the path instead of a diff_filespec
log -L: test merge of parallel modify/rename
t4211: pass -M to 'git log -M -L...' test
log -L: fix overlapping input ranges
log -L: check range set invariants when we look it up
Speed up log -L... -M
log -L: :pattern:file syntax to find by funcname
Implement line-history search (git log -L)
Export rewrite_parents() for 'log -L'
Refactor parse_loc
Diffstat (limited to 'line-range.h')
-rw-r--r-- | line-range.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/line-range.h b/line-range.h new file mode 100644 index 0000000000..ae3d0123b4 --- /dev/null +++ b/line-range.h @@ -0,0 +1,36 @@ +#ifndef LINE_RANGE_H +#define LINE_RANGE_H + +/* + * Parse one item in an -L begin,end option w.r.t. the notional file + * object 'cb_data' consisting of 'lines' lines. + * + * The 'nth_line_cb' callback is used to determine the start of the + * 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. + * + * 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. + */ + +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, + long *begin, long *end, + const char *path); + +/* + * Scan past a range argument that could be parsed by + * 'parse_range_arg', to help the caller determine the start of the + * filename in '-L n,m:file' syntax. + * + * Returns a pointer to the first character after the 'n,m' part, or + * NULL in case the argument is obviously malformed. + */ + +extern const char *skip_range_arg(const char *arg); + +#endif /* LINE_RANGE_H */ |