Skip to content

Preserve commit hyperlinks in colored log output - #2212

Open
fzlzjerry wants to merge 1 commit into
dandavison:mainfrom
fzlzjerry:fix/2145-colored-commit-links
Open

Preserve commit hyperlinks in colored log output#2212
fzlzjerry wants to merge 1 commit into
dandavison:mainfrom
fzlzjerry:fix/2145-colored-commit-links

Conversation

@fzlzjerry

Copy link
Copy Markdown

Summary

  • match commit hashes against the ANSI-stripped visible text so SGR color sequences do not interfere with word boundaries
  • map each match back to the original line before adding the OSC 8 link, preserving the existing color bytes in the displayed hash
  • add regression coverage for a red, seven-character abbreviated commit hash

Fixes #2145.

Testing

  • cargo test (438 passed, 8 ignored)
  • cargo clippy -- -D warnings
  • cargo fmt --all -- --check
  • ./tests/test_deprecated_options
  • env -u GIT_PAGER ./tests/test_navigate_less_history_file in a PTY

./tests/test_raw_output_matches_git_on_full_repo_history reports only pre-existing omissions of Binary files ... differ lines for old binary assets. The same diff reproduces on a clean origin/main worktree.

@fzlzjerry
fzlzjerry marked this pull request as ready for review August 11, 2026 08:56
Copilot AI lite review requested due to automatic review settings August 11, 2026 08:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

🐛 Colors break commit hyperlinks since upgrade to 0.19.2

2 participants