Skip to content

fix: pr-reference skill script skips half of files in some cases #1375

@katriendg

Description

@katriendg

Description

list-changed-files.sh silently skips every other file when all changed files are modified (no added/deleted/renamed interleaving).

Root Cause

The extract_files function uses an inner read to peek at the next line for change-type detection, but it consumes from the same input stream as the outer while read loop. When consecutive diff --git lines have no intervening new file/deleted file/rename from lines, the inner read swallows the next file's header.

Fix

Replace the stream-based while read with mapfile into an array and use index-based lookahead. The PowerShell counterpart (list-changed-files.ps1) is unaffected — it uses regex block matching.

Acceptance Criteria

  • list-changed-files.sh returns all files when every file is modified
  • Mixed change types (added, deleted, renamed, modified) still classify correctly
  • Filters (--type, --exclude-type) work with the updated parsing

Metadata

Metadata

Assignees

Labels

skillsCopilot skill packages (SKILL.md)

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions