This repository was archived by the owner on Aug 7, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +26
-7
lines changed
Expand file tree Collapse file tree 4 files changed +26
-7
lines changed Original file line number Diff line number Diff line change 77 "os"
88)
99
10- const VERSION = "0.1.6 "
10+ const VERSION = "0.1.7 "
1111
1212func main () {
1313 version := flag .Bool ("version" , false , "Display version" )
Original file line number Diff line number Diff line change 11#! /bin/bash -ex
22
3- VERSION=" 0.1.6 "
3+ VERSION=" 0.1.7 "
44GIT_PRE_COMMIT_HOOK=" .git/hooks/pre-commit"
55COMMITTER_YML=" committer.yml"
66COMMITTER_LOCATION=" /usr/local/bin/committer"
Original file line number Diff line number Diff line change @@ -8,10 +8,11 @@ import (
88)
99
1010type Task struct {
11- Name string
12- Command string
13- Files string
14- Fix struct {
11+ Name string
12+ Command string
13+ Files string
14+ ExcludeFilenames bool
15+ Fix struct {
1516 Command string
1617 Output string
1718 Autostage bool
@@ -112,7 +113,7 @@ func (task Task) prepareCommand(fix bool) []string {
112113
113114 // Feed in changed files if we are running with --changed
114115 relevantChangedFilesList := task .relevantChangedFiles (changedFilesList )
115- if len (relevantChangedFilesList ) > 0 {
116+ if ! task . ExcludeFilenames && len (relevantChangedFilesList ) > 0 {
116117 cmdStr += " " + strings .Join (relevantChangedFilesList , " " )
117118 }
118119
Original file line number Diff line number Diff line change @@ -51,6 +51,24 @@ func TestPrepareCommand(t *testing.T) {
5151 )
5252}
5353
54+ func TestPrepareCommandWithExcludeFilenames (t * testing.T ) {
55+ origChangedFiles := changedFilesList
56+ changedFilesList = []string {"one.rb" , "two.js" , "three.txt" }
57+ defer func () { changedFilesList = origChangedFiles }()
58+
59+ var task Task
60+ task .Command = "run-task"
61+ task .Files = ".txt"
62+ task .ExcludeFilenames = true
63+
64+ assert .Equal (
65+ t ,
66+ []string {"run-task" },
67+ task .prepareCommand (false ),
68+ "It correctly passes no file names" ,
69+ )
70+ }
71+
5472func TestPrepareFixedOutput (t * testing.T ) {
5573 var task Task
5674 task .Fix .Output = "Fixed:"
You can’t perform that action at this time.
0 commit comments