Skip to content

Commit be29b60

Browse files
committed
Add some more predefined refgroups:
* `pulls` — GitHub style pull request references (`refs/pull/**`) * `changes` — Gerrit style changeset references (`refs/changes/**`)
1 parent a067cc3 commit be29b60

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

git-sizer.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,11 @@ const Usage = `usage: git-sizer [OPTS]
7575
REGEXP patterns must match the full reference name.
7676
7777
REFGROUP can be the name of a predefined reference group ('branches',
78-
'tags', 'remotes', 'notes', or 'stash'), or one defined via
79-
gitconfig settings like the following (these can be repeated):
78+
'tags', 'remotes', 'pulls', 'changes', 'notes', or 'stash'), or one
79+
defined via gitconfig settings like the following (the
80+
include/exclude settings can be repeated):
8081
82+
* 'refgroup.REFGROUP.name=NAME'
8183
* 'refgroup.REFGROUP.include=PREFIX'
8284
* 'refgroup.REFGROUP.includeRegexp=REGEXP'
8385
* 'refgroup.REFGROUP.exclude=PREFIX'

internal/refopts/ref_group_builder.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,17 @@ func (rgb *RefGroupBuilder) initializeStandardRefgroups() {
8989
initializeGroup("branches", "Branches", git.PrefixFilter("refs/heads/"))
9090
initializeGroup("tags", "Tags", git.PrefixFilter("refs/tags/"))
9191
initializeGroup("remotes", "Remote-tracking refs", git.PrefixFilter("refs/remotes/"))
92+
initializeGroup("pulls", "Pull request refs", git.PrefixFilter("refs/pull/"))
93+
94+
filter, err := git.RegexpFilter(`refs/changes/\d{2}/\d+/\d+`)
95+
if err != nil {
96+
panic("internal error")
97+
}
98+
initializeGroup("changes", "Changeset refs", filter)
99+
92100
initializeGroup("notes", "Git notes", git.PrefixFilter("refs/notes/"))
93101

94-
filter, err := git.RegexpFilter("refs/stash")
102+
filter, err = git.RegexpFilter(`refs/stash`)
95103
if err != nil {
96104
panic("internal error")
97105
}

0 commit comments

Comments
 (0)