parseRenameNameStatus parses `--name-status` rename rows ("R \told\tnew") into an absolute old->new map, or nil when there are none.
(stdout []byte, repoRoot string)
| 166 | // parseRenameNameStatus parses `--name-status` rename rows ("R<score>\told\tnew") |
| 167 | // into an absolute old->new map, or nil when there are none. |
| 168 | func parseRenameNameStatus(stdout []byte, repoRoot string) map[string]string { |
| 169 | renames := make(map[string]string) |
| 170 | for _, line := range strings.Split(string(stdout), "\n") { |
| 171 | if line == "" || line[0] != 'R' { |
| 172 | continue |
| 173 | } |
| 174 | fields := strings.Split(line, "\t") |
| 175 | if len(fields) != 3 { |
| 176 | continue |
| 177 | } |
| 178 | oldPath := filepath.Join(repoRoot, strings.TrimSpace(fields[1])) |
| 179 | newPath := filepath.Join(repoRoot, strings.TrimSpace(fields[2])) |
| 180 | renames[oldPath] = newPath |
| 181 | } |
| 182 | if len(renames) == 0 { |
| 183 | return nil |
| 184 | } |
| 185 | return renames |
| 186 | } |
| 187 | |
| 188 | // getUncommittedFiles returns a list of all uncommitted files (relative to repo root) |
| 189 | func getUncommittedFiles(repoPath string) ([]string, error) { |
no outgoing calls
no test coverage detected