Skip to content
Permalink
Browse files
fix(dev): submodule changes may not be taken into account
  • Loading branch information
alexey-igrychev committed Oct 4, 2021
1 parent 4faa97d commit f3b2fabbf169420e68ecad04fcf4834694f79c29
Showing with 15 additions and 4 deletions.
  1. +1 −1 pkg/git_repo/local.go
  2. +14 −3 pkg/true_git/status/result.go
@@ -76,7 +76,7 @@ func OpenLocalRepo(ctx context.Context, name, workTreeDir string, opts OpenLocal
return nil, fmt.Errorf("unable to get git status: %s", err)
}

if len(gitStatusResult.PathList()) != 0 {
if len(gitStatusResult.PathListWithSubmodules()) != 0 {
devHeadCommit, err := true_git.SyncSourceWorktreeWithServiceBranch(
context.Background(),
l.GitDir,
@@ -12,10 +12,21 @@ func (r *Result) IndexWithWorktree() Scope {
return ComplexScope{scopes: []Scope{r.Index, r.Worktree}}
}

// PathList returns a list of changed files
func (r *Result) PathList() (result []string) {
// PathListWithSubmodules returns a list of changed files
func (r *Result) PathListWithSubmodules() (result []string) {
keys := map[string]bool{}
for _, path := range append(r.IndexWithWorktree().PathList(), r.UntrackedPathList...) {

var allPaths []string
{
allPaths = append(allPaths, r.IndexWithWorktree().PathList()...)
for _, s := range r.IndexWithWorktree().Submodules() {
allPaths = append(allPaths, s.Path)
}

allPaths = append(allPaths, r.UntrackedPathList...)
}

for _, path := range allPaths {
_, exist := keys[path]
if !exist {
result = append(result, path)

0 comments on commit f3b2fab

Please sign in to comment.