File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -105,21 +105,23 @@ func diff(command string) ([]string, error) {
105105 return nil , fmt .Errorf ("diff command failed: %v" , err )
106106 }
107107
108- trimmed := strings .Trim (output , " \t \r \v \f " )
109- if trimmed == "" {
108+ hasNewlines := strings .ContainsRune (output , '\n' )
109+ output = strings .TrimRight (output , "\n " )
110+ if output == "" {
110111 return []string {}, nil
111112 }
112113
113114 var fields []string
114- if strings . Contains ( trimmed , " \n " ) {
115- for _ , line := range strings .Split (trimmed , "\n " ) {
115+ if hasNewlines {
116+ for _ , line := range strings .Split (output , "\n " ) {
116117 line = strings .TrimSpace (line )
117118 if line != "" {
118119 fields = append (fields , line )
119120 }
120121 }
121122 } else {
122- fields = strings .Fields (trimmed )
123+ // Single line without newline — legacy compat for custom diff commands
124+ fields = strings .Fields (output )
123125 }
124126
125127 paths := make ([]string , 0 , len (fields ))
You can’t perform that action at this time.
0 commit comments