uses git status --porcelain. To work properly files have to be staged.
(rootDir string)
| 912 | |
| 913 | // uses git status --porcelain. To work properly files have to be staged. |
| 914 | func getModifiedFiles(rootDir string) []string { |
| 915 | say.Debug("Find modified files") |
| 916 | oldWorkingDir := workingDir |
| 917 | workingDir = rootDir |
| 918 | gitstatus := silentgit("status", "--porcelain") |
| 919 | workingDir = oldWorkingDir |
| 920 | lines := strings.Split(gitstatus, "\n") |
| 921 | files := []string{} |
| 922 | for _, line := range lines { |
| 923 | relativeFilepath := "" |
| 924 | if strings.HasPrefix(line, "M") { |
| 925 | relativeFilepath = strings.TrimPrefix(line, "M") |
| 926 | } else if strings.HasPrefix(line, "A") { |
| 927 | relativeFilepath = strings.TrimPrefix(line, "A") |
| 928 | } else { |
| 929 | continue |
| 930 | } |
| 931 | relativeFilepath = strings.TrimSpace(relativeFilepath) |
| 932 | say.Debug(relativeFilepath) |
| 933 | files = append(files, relativeFilepath) |
| 934 | } |
| 935 | return files |
| 936 | } |
| 937 | |
| 938 | func gitHooksOption(c config.Configuration) string { |
| 939 | if c.GitHooksEnabled { |
no test coverage detected