summaryrefslogtreecommitdiff
path: root/Documentation/line-range-format.txt
diff options
context:
space:
mode:
authorBo Yang <struggleyb.nku@gmail.com>2013-03-28 17:47:30 +0100
committerJunio C Hamano <gitster@pobox.com>2013-03-28 10:28:41 -0700
commit25ed3412f86b136efb17689b6712d9e546cac388 (patch)
treefdb5d94dcd935ce30be00a616ff1619752421179 /Documentation/line-range-format.txt
parent443d803e0dacd0a1c6700503689f3cd95751aba1 (diff)
downloadgit-25ed3412f86b136efb17689b6712d9e546cac388.tar.gz
Refactor parse_loc
We want to use the same style of -L n,m argument for 'git log -L' as for git-blame. Refactor the argument parsing of the range arguments from builtin/blame.c to the (new) file that will hold the 'git log -L' logic. To accommodate different data structures in blame and log -L, the file contents are abstracted away; parse_range_arg takes a callback that it uses to get the contents of a line of the (notional) file. The new test is for a case that made me pause during debugging: the 'blame -L with invalid end' test was the only one that noticed an outright failure to parse the end *at all*. So make a more explicit test for that. Signed-off-by: Bo Yang <struggleyb.nku@gmail.com> Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/line-range-format.txt')
-rw-r--r--Documentation/line-range-format.txt18
1 files changed, 18 insertions, 0 deletions
diff --git a/Documentation/line-range-format.txt b/Documentation/line-range-format.txt
new file mode 100644
index 0000000000..265bc23290
--- /dev/null
+++ b/Documentation/line-range-format.txt
@@ -0,0 +1,18 @@
+- number
++
+If <start> or <end> is a number, it specifies an
+absolute line number (lines count from 1).
++
+
+- /regex/
++
+This form will use the first line matching the given
+POSIX regex. If <end> is a regex, it will search
+starting at the line given by <start>.
++
+
+- +offset or -offset
++
+This is only valid for <end> and will specify a number
+of lines before or after the line given by <start>.
++