Skip to content

Commit 5a47467

Browse files
committed
fix: normalize path separators for Windows compatibility
Use forward slashes in DOT graph output so list command produces portable, consistent output across platforms. Convert gitRoot to OS-native separators so boundary checks in dependent discovery work correctly on Windows (git returns forward slashes, but filesystem walks return backslashes).
1 parent 7d76f7d commit 5a47467

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

internal/cli/commands/list/list.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,10 +507,12 @@ func renderDot(opts *Options, components dag.ListedComponents) error {
507507
style = "[color=red]"
508508
}
509509

510-
fmt.Fprintf(&buf, "\t\"%s\" %s;\n", component.Path, style)
510+
componentPath := filepath.ToSlash(component.Path)
511+
512+
fmt.Fprintf(&buf, "\t\"%s\" %s;\n", componentPath, style)
511513

512514
for _, dep := range component.Dependencies {
513-
fmt.Fprintf(&buf, "\t\"%s\" -> \"%s\";\n", component.Path, dep.Path)
515+
fmt.Fprintf(&buf, "\t\"%s\" -> \"%s\";\n", componentPath, filepath.ToSlash(dep.Path))
514516
}
515517
}
516518

internal/discovery/discovery.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func (d *Discovery) Discover(
4747
if d.classifier.HasGraphFilters() {
4848
if d.classifier.HasDependentFilters() && d.gitRoot == "" {
4949
if gitRootPath, gitErr := shell.GitTopLevelDir(ctx, l, opts.Env, d.workingDir); gitErr == nil {
50-
d.gitRoot = gitRootPath
50+
d.gitRoot = filepath.FromSlash(gitRootPath)
5151
l.Debugf("Set gitRoot for dependent discovery: %s", d.gitRoot)
5252
}
5353
}

0 commit comments

Comments
 (0)