Skip to content

Commit

Permalink
fix: unique names for nested operations (#931)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrexox authored Jan 17, 2025
1 parent 82f1c78 commit 4711444
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions internal/lefthook/runner/run_jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"path/filepath"
"slices"
"strconv"
"strings"
"sync"
"sync/atomic"

Expand All @@ -29,6 +30,7 @@ type domain struct {
root string
exclude interface{}
onlyJobs []string
names []string
}

func (r *Runner) runJobs(ctx context.Context) []Result {
Expand Down Expand Up @@ -107,7 +109,8 @@ func (r *Runner) runJob(ctx context.Context, domain *domain, id string, job *con
default:
inheritedDomain.exclude = job.Exclude
}
groupName := first(job.Name, "["+id+"]")
groupName := first(job.Name, "group ("+id+")")
inheritedDomain.names = append(inheritedDomain.names, groupName)

if len(domain.onlyJobs) != 0 && slices.Contains(domain.onlyJobs, job.Name) {
inheritedDomain.onlyJobs = []string{}
Expand Down Expand Up @@ -158,7 +161,7 @@ func (r *Runner) runSingleJob(ctx context.Context, domain *domain, id string, jo
}

ok := r.run(ctx, exec.Options{
Name: name,
Name: strings.Join(append(domain.names, name), " ❯ "),
Root: filepath.Join(r.Repo.RootPath, root),
Commands: executionJob.Execs,
Interactive: job.Interactive && !r.DisableTTY,
Expand Down

0 comments on commit 4711444

Please sign in to comment.