Skip to content

Commit 3bcb0cd

Browse files
committed
Reference filtering: improve the usage note
And make the tests more resemble the examples from the usage note.
1 parent f9bab83 commit 3bcb0cd

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

git-sizer.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
const Usage = `usage: git-sizer [OPTS]
2020
2121
-v, --verbose report all statistics, whether concerning or not
22-
--threshold threshold minimum level of concern (i.e., number of stars)
22+
--threshold THRESHOLD minimum level of concern (i.e., number of stars)
2323
that should be reported. Default:
2424
'--threshold=1'.
2525
--critical only report critical statistics
@@ -43,18 +43,20 @@ const Usage = `usage: git-sizer [OPTS]
4343
--branches process branches
4444
--tags process tags
4545
--remotes process remote refs
46-
--include prefix process references with the specified prefix
46+
--include PREFIX process references with the specified PREFIX
4747
(e.g., '--include=refs/remotes/origin')
48-
--include-regexp pattern process references matching the specified
48+
--include-regexp REGEXP process references matching the specified
4949
regular expression (e.g.,
5050
'--include-regexp=refs/tags/release-.*')
51-
--exclude prefix don't process references with the specified
52-
prefix (e.g., '--exclude=refs/notes')
53-
--exclude-regexp pattern don't process references matching the specified
51+
--exclude PREFIX don't process references with the specified
52+
PREFIX (e.g., '--exclude=refs/notes')
53+
--exclude-regexp REGEXP don't process references matching the specified
5454
regular expression
5555
--show-refs show which refs are being included/excluded
5656
57-
Regular expression patterns must match the full reference name.
57+
Prefixes must match at a boundary; for example 'refs/foo' matches
58+
'refs/foo' and 'refs/foo/bar' but not 'refs/foobar'. Regular
59+
expression patterns must match the full reference name.
5860
5961
`
6062

git/ref_filter_test.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,16 @@ func TestPrefixFilter(t *testing.T) {
2323
{"refs/heads", "refs/he", false},
2424
{"refs/heads", "refs/headstrong", false},
2525
{"refs/heads", "refs/tags/refs/heads", false},
26-
{"refs/heads/", "refs/heads", false},
27-
{"refs/heads/", "refs/heads/foo/bar", true},
26+
27+
{"refs/foo", "refs/foo/bar", true},
28+
{"refs/foo", "refs/foo", true},
29+
{"refs/foo", "refs/foobar", false},
30+
31+
{"refs/foo/", "refs/foo/bar", true},
32+
{"refs/foo/", "refs/foo", false},
33+
{"refs/foo/", "refs/foobar", false},
34+
2835
{"refs/stash", "refs/stash", true},
29-
{"refs/stash", "refs/stashy", false},
3036
{"refs/remotes", "refs/remotes/origin/master", true},
3137
} {
3238
t.Run(

0 commit comments

Comments
 (0)