File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -106,20 +106,16 @@ func diff(command string) ([]string, error) {
106106 }
107107
108108 trimmed := strings .TrimSpace (output )
109+ if trimmed == "" {
110+ return nil , nil
111+ }
109112
110- // Git diff --name-only outputs one file per line. Split on newlines to
111- // preserve filenames that contain spaces. Fall back to strings.Fields
112- // for single-line output (e.g. legacy diff commands) for backward compat.
113113 var fields []string
114- if strings .Contains (trimmed , "\n " ) {
115- for _ , line := range strings .Split (trimmed , "\n " ) {
116- line = strings .TrimSpace (line )
117- if line != "" {
118- fields = append (fields , line )
119- }
114+ for _ , line := range strings .Split (trimmed , "\n " ) {
115+ line = strings .TrimSpace (line )
116+ if line != "" {
117+ fields = append (fields , line )
120118 }
121- } else {
122- fields = strings .Fields (trimmed )
123119 }
124120
125121 paths := make ([]string , 0 , len (fields ))
You can’t perform that action at this time.
0 commit comments