From 4711444fd6532d17e8971d30c3e4d7e96d2b02fb Mon Sep 17 00:00:00 2001 From: Valentin Kiselev Date: Fri, 17 Jan 2025 11:44:21 +0300 Subject: [PATCH] fix: unique names for nested operations (#931) --- internal/lefthook/runner/run_jobs.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/lefthook/runner/run_jobs.go b/internal/lefthook/runner/run_jobs.go index 080d89c2..0a31f799 100644 --- a/internal/lefthook/runner/run_jobs.go +++ b/internal/lefthook/runner/run_jobs.go @@ -6,6 +6,7 @@ import ( "path/filepath" "slices" "strconv" + "strings" "sync" "sync/atomic" @@ -29,6 +30,7 @@ type domain struct { root string exclude interface{} onlyJobs []string + names []string } func (r *Runner) runJobs(ctx context.Context) []Result { @@ -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{} @@ -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,