Skip to content

fix(diff): place --color flag before pathspec separator - #2933

Merged
Jguer merged 1 commit into
Jguer:nextfrom
danny-kuehn:fix/diff-color-pathspec
Jul 30, 2026
Merged

fix(diff): place --color flag before pathspec separator#2933
Jguer merged 1 commit into
Jguer:nextfrom
danny-kuehn:fix/diff-color-pathspec

Conversation

@danny-kuehn

Copy link
Copy Markdown
Contributor

Since #2905, PKGBUILD diffs lose color even with Color enabled in pacman.conf.

collectPkgbuildDiffs appends --color=always/never after the --
separator, so git treats it as a pathspec and ignores it. This predates
#2905 but was masked: Show() gave git a TTY, so auto color worked. With
Capture() git sees a pipe and disables color.

Fix: append the color flag before the range and pathspecs.

Tested: TZ=UTC make test, make lint, and manual diff review with color
on/off. Related: #2905, #1243.

@danny-kuehn
danny-kuehn requested a review from Jguer as a code owner July 25, 2026 12:24
@Jguer

Jguer commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Awesome find @danny-kuehn , thanks for fixing this.

@Jguer
Jguer merged commit f7c3643 into Jguer:next Jul 30, 2026
9 checks passed
@danny-kuehn
danny-kuehn deleted the fix/diff-color-pathspec branch July 30, 2026 19:16
@radon-at-beeper

Copy link
Copy Markdown

Just for anyone else who finds this: the behavior still changes compared to before #1243, when diffs would be colorized under git config color.ui auto, even if Color was not enabled in pacman.conf. Now, it is required to enable Color in pacman.conf (just uncomment the line that says Color), if you want color in Yay diffs.

This is arguably more consistent, although it is surprising since the behavior changed, and some people might expect that configuring Git to color diffs would also apply to Git diffs within Yay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants