087db1de70
Since we're about to do a v3.0.0 release, let's bump the version to v3. Make this change automatically with the following command to avoid any missed items: git grep -l github.com/git-lfs/git-lfs/v2 | \ xargs sed -i -e 's!github.com/git-lfs/git-lfs/v2!github.com/git-lfs/git-lfs/v3!g'
50 lines
1.2 KiB
Go
50 lines
1.2 KiB
Go
package commands
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/git-lfs/git-lfs/v3/config"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
var (
|
|
testcfg = config.NewFrom(config.Values{
|
|
Git: map[string][]string{
|
|
"lfs.fetchinclude": []string{"/default/include"},
|
|
"lfs.fetchexclude": []string{"/default/exclude"},
|
|
},
|
|
})
|
|
)
|
|
|
|
func TestDetermineIncludeExcludePathsReturnsCleanedPaths(t *testing.T) {
|
|
inc := "/some/include"
|
|
exc := "/some/exclude"
|
|
i, e := determineIncludeExcludePaths(testcfg, &inc, &exc, true)
|
|
|
|
assert.Equal(t, []string{"/some/include"}, i)
|
|
assert.Equal(t, []string{"/some/exclude"}, e)
|
|
}
|
|
|
|
func TestDetermineIncludeExcludePathsReturnsEmptyPaths(t *testing.T) {
|
|
inc := ""
|
|
exc := ""
|
|
i, e := determineIncludeExcludePaths(testcfg, &inc, &exc, true)
|
|
|
|
assert.Empty(t, i)
|
|
assert.Empty(t, e)
|
|
}
|
|
|
|
func TestDetermineIncludeExcludePathsReturnsDefaultsWhenAbsent(t *testing.T) {
|
|
i, e := determineIncludeExcludePaths(testcfg, nil, nil, true)
|
|
|
|
assert.Equal(t, []string{"/default/include"}, i)
|
|
assert.Equal(t, []string{"/default/exclude"}, e)
|
|
}
|
|
|
|
func TestDetermineIncludeExcludePathsReturnsNothingWhenAbsent(t *testing.T) {
|
|
i, e := determineIncludeExcludePaths(testcfg, nil, nil, false)
|
|
|
|
assert.Empty(t, i)
|
|
assert.Empty(t, e)
|
|
}
|