Skip to content

Commit

Permalink
ci: fix dirty detection by excluding subpaths as well (dagger#8997)
Browse files Browse the repository at this point in the history
The dirty detection wasn't working with the pattern
`:(exclude)**/.dagger` - we need to also exclude all subpaths, i.e.
`:(exclude)**/.dagger/**`.`

This appeared when adding a module into `dagger/cmd` in
fd6a019, and the pattern detected that
the module file contents were deleted, and so even fresh commits would
be marked as dirty.

Signed-off-by: Justin Chadwell <[email protected]>
  • Loading branch information
jedevc authored Nov 19, 2024
1 parent f251869 commit fb5e3f5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion version/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,8 @@ func (git *Git) status(ctx context.Context) (string, error) {

args := []string{"git", "status", "--porcelain", "--"}
for _, ignore := range ignores {
args = append(args, ":(exclude)"+ignore)
pathspec := ":(exclude)" + ignore
args = append(args, pathspec, pathspec+"/**")
}
result, err := git.Container.WithExec(args).Stdout(ctx)
if err != nil {
Expand Down

0 comments on commit fb5e3f5

Please sign in to comment.