Skip to content

fix(skills): read-diff.sh --summary reports +0/-0 for every file #3131

Closed

Description

Component

pr-reference skill (.github/skills/shared/pr-reference/scripts/read-diff.sh)

Bug Description

read-diff.sh --summary reports (+0/-0) for every file and splits each file's line across three lines.

For each file, grep -A 1000 "diff --git a/${file} b/" starts its output with that file's own header, and grep -m 1 -B 1000 "^diff --git" then stops on that same line. Only the header is left to count, so grep -c "^+" and grep -c "^-" print 0. grep -c also exits 1 when nothing matches, so the || echo "0" fallback appends a second 0, and the value becomes 0 newline 0.

The PowerShell twin is fine: read-diff.ps1 -Summary on the same input prints src/a.txt (+2/-1) and src/b.txt (+1/-1).

Expected Behavior

One line per file with the real counts, the same as read-diff.ps1 reports for the same diff.

Steps to Reproduce

With a pr-reference.xml whose diff changes src/a.txt by +2/-1 and src/b.txt by +1/-1, bash read-diff.sh --input pr.xml --summary prints:

Changed files:
  src/a.txt (+0
0/-0
0)
  src/b.txt (+0
0/-0
0)

Activity

  1. added a commit that references this issue on Oct 9, 2026
    c3a8603
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions