Skip to content

[BUG] Piped diffs render empty with diff.mnemonicPrefix / diff.noprefix git configs #55

Description

@johan-lejdung

Describe the bug
Piping a diff into difi renders an empty file tree when git is configured with diff.mnemonicPrefix=true (and presumably diff.noprefix=true). ParseFilesFromDiff and ExtractFileDiff in internal/git/client.go only match headers starting literally with diff --git a/, but mnemonicPrefix produces e.g. diff --git c/package-lock.json w/package-lock.json, so no files are ever matched. Workaround: git diff --default-prefix | difi.

To Reproduce
Steps to reproduce the behavior:

  1. git config diff.mnemonicPrefix true
  2. Run git diff HEAD~1 | difi in a repo where that diff is non-empty
  3. difi opens with an empty file tree and no diff content

Expected behavior
Piped diffs render regardless of git prefix configuration, or difi documents the limitation.

Environment (please complete the following information):

  • OS: macOS (Apple Silicon, latest)
  • Terminal Emulator: Ghostty
  • Difi Version: v0.2.1 (parsing code unchanged on main)

Screenshots
N/A

Additional context
A generic header match would fix it, e.g. treating any diff --git <p>/<path> <p>/<path> prefix pair (or no prefix) as valid.

Activity

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

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions