MCPcopy Create free account
hub / github.com/remotemobprogramming/mob / getModifiedFiles

Function getModifiedFiles

mob.go:914–936  ·  view source on GitHub ↗

uses git status --porcelain. To work properly files have to be staged.

(rootDir string)

Source from the content-addressed store, hash-verified

912
913// uses git status --porcelain. To work properly files have to be staged.
914func 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
938func gitHooksOption(c config.Configuration) string {
939 if c.GitHooksEnabled {

Callers 1

Calls 2

DebugFunction · 0.92
silentgitFunction · 0.85

Tested by

no test coverage detected