Skip to content

Commit 75327e7

Browse files
committed
Fix bug
1 parent 1e09c0d commit 75327e7

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

modules/git/attribute/batch.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ type BatchChecker struct {
3636
// NewBatchChecker creates a check attribute reader for the current repository and provided commit ID
3737
func NewBatchChecker(repo *git.Repository, treeish string, attributes ...string) (*BatchChecker, error) {
3838
ctx, cancel := context.WithCancel(repo.Ctx)
39+
if len(attributes) == 0 {
40+
attributes = LinguistAttributes
41+
}
3942
checker := &BatchChecker{
4043
Attributes: attributes,
4144
Repo: repo,

modules/git/attribute/checker.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ func checkAttrCommand(gitRepo *git.Repository, treeish string, filenames, attrib
1818
if len(attributes) == 0 {
1919
cmd.AddArguments("--all")
2020
}
21-
cmd.AddDashesAndList(filenames...)
21+
if len(filenames) > 0 {
22+
cmd.AddDashesAndList(filenames...)
23+
}
2224
cancel := func() {}
2325
if git.DefaultFeatures().SupportCheckAttrOnBare && treeish != "" {
2426
cmd.AddArguments("--source")

0 commit comments

Comments
 (0)