Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -1643,7 +1643,7 @@ func formatDiffEntry(d model.Diff) string {
case d.IsRenamed:
status = "RENAMED"
}
return fmt.Sprintf("%s %s (+%d/-%d)", status, d.NewPath, d.Insertions, d.Deletions)
return fmt.Sprintf("%s %s (+%d/-%d)", status, effectivePath(d), d.Insertions, d.Deletions)
}

// buildChangeFilesExceptGroup returns a formatted list of changed files excluding all group members.
Expand Down
7 changes: 6 additions & 1 deletion internal/agent/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,9 @@ func TestBuildChangeFilesExceptGroup(t *testing.T) {
{NewPath: "main.go", OldPath: "main.go", Insertions: 4, Deletions: 2},
{NewPath: "moved_new.go", OldPath: "moved_old.go", IsRenamed: true},
{NewPath: "helper.go", OldPath: "helper.go", IsNew: true, Insertions: 12},
{NewPath: "removed.go", OldPath: "removed.go", IsDeleted: true, Deletions: 30},
// A deletion as ParseDiffText produces it: NewPath is the sentinel and
// the name is in OldPath.
{NewPath: "/dev/null", OldPath: "removed.go", IsDeleted: true, Deletions: 30},
{NewPath: "renamed.go", OldPath: "old_name.go", IsRenamed: true, Insertions: 5, Deletions: 5},
{NewPath: "bin.dat", OldPath: "bin.dat", IsBinary: true},
}
Expand Down Expand Up @@ -953,6 +955,9 @@ func TestBuildChangeFilesExceptGroup(t *testing.T) {
if strings.Contains(got, "bin.dat") {
t.Error("binary files should be skipped")
}
if strings.Contains(got, "/dev/null") {
t.Errorf("a deletion must be listed under its own path, not the /dev/null sentinel; got:\n%s", got)
}

// The separator is emitted before each entry, so a skipped final diff cannot
// leave a trailing newline behind. Excluding an entire group (plus binaries)
Expand Down
Loading