add refs/stash and tests
This commit is contained in:
parent
4d1004bd3c
commit
42b4bc25a3
@ -128,6 +128,13 @@ func rewriteOptions(args []string, opts *githistory.RewriteOptions, l *tasklog.L
|
||||
// isSpecialGitRef checks if a ref spec is a special git ref to exclude from
|
||||
// --everything
|
||||
func isSpecialGitRef(refspec string) bool {
|
||||
// Special refspecs.
|
||||
switch refspec {
|
||||
case "refs/stash":
|
||||
return true
|
||||
}
|
||||
|
||||
// Special refspecs from namespaces.
|
||||
parts := strings.SplitN(refspec, "/", 3)
|
||||
if len(parts) < 3 {
|
||||
return false
|
||||
|
@ -47,3 +47,11 @@ func TestDetermineIncludeExcludePathsReturnsNothingWhenAbsent(t *testing.T) {
|
||||
assert.Empty(t, i)
|
||||
assert.Empty(t, e)
|
||||
}
|
||||
|
||||
func TestSpecialGitRefsExclusion(t *testing.T) {
|
||||
assert.True(t, isSpecialGitRef("refs/notes/commits"))
|
||||
assert.True(t, isSpecialGitRef("refs/bisect/bad"))
|
||||
assert.True(t, isSpecialGitRef("refs/replace/abcdef90"))
|
||||
assert.True(t, isSpecialGitRef("refs/stash"))
|
||||
assert.False(t, isSpecialGitRef("refs/commits/abcdef90"))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user