Skip to content

fix: preserve LESS options in enter pager - #551

Open
wfxr wants to merge 1 commit into
mainfrom
fix/preserve-less-options
Open

fix: preserve LESS options in enter pager#551
wfxr wants to merge 1 commit into
mainfrom
fix/preserve-less-options

Conversation

@wfxr

@wfxr wfxr commented Aug 19, 2026

Copy link
Copy Markdown
Owner

Check list

  • I have performed a self-review of my code
  • I have commented my code in hard-to-understand areas
  • I have added unit tests for my code
  • I have made corresponding changes to the documentation

Description

Preserve user-defined LESS options when opening the full-screen Enter pager. Like Git, forgit now honors an existing LESS value rather than replacing it; the required color and stay-open behavior is expressed through command-line options.

Add regression coverage for inherited LESS options and document the default FORGIT_ENTER_PAGER behavior.

Fixes #538.

Type of change

  • Bug fix
  • New feature
  • Refactor
  • Breaking change
  • Test
  • Documentation change
  • CI change

Test environment

  • Shell
    • bash
    • zsh
    • fish
  • OS
    • Linux
    • Mac OS X
    • Windows
    • Others:

Additional verification: lib/bashunit tests (74 tests, 123 assertions), shfmt, Bash syntax check, rumdl, and ShellCheck 0.11.0 with the repository's pre-existing SC2218 findings excluded.

Summary by CodeRabbit

  • New Features

    • Added FORGIT_ENTER_PAGER configuration for customizing the pager used when entering interactive views.
    • The default pager now preserves existing LESS settings while preventing automatic exit behavior.
  • Documentation

    • Documented the new pager configuration option, its default value, and configuration behavior.
  • Tests

    • Added coverage to verify pager environment preservation and interactive behavior.

Pass the required color and stay-open flags directly to less so forgit no longer replaces users' LESS environment options. Add regression coverage and document the default behavior.
@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 13ea6197-a7da-48cd-bbca-975ea62ba9d9

📥 Commits

Reviewing files that changed from the base of the PR and between 15db001 and 7673299.

📒 Files selected for processing (3)
  • README.md
  • bin/git-forgit
  • tests/pager.test.sh

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The Enter pager now uses explicit less options without resetting LESS. The README documents FORGIT_ENTER_PAGER, and a Bash test verifies the command and environment behavior.

Changes

Pager configuration

Layer / File(s) Summary
Enter pager behavior and validation
bin/git-forgit, README.md, tests/pager.test.sh
The default Enter pager now runs less -R -+F -+E. The documentation describes FORGIT_ENTER_PAGER and its defaults. The test verifies LESS preservation and the explicit pager options.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 76732

This localized change preserves user-defined LESS options while retaining the pager's required behavior, with regression coverage and documentation updates; no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: carlfriedrich, cjappl, sandr01d

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary change: preserving user-defined LESS options in the Enter pager.
Description check ✅ Passed The description follows the template, explains the change, lists testing, and identifies the bug fix, test, and documentation updates.
Linked Issues check ✅ Passed The changes satisfy issue #538 by preserving LESS options and documenting FORGIT_ENTER_PAGER behavior.
Out of Scope Changes check ✅ Passed The README, pager implementation, and regression tests are directly related to the linked issue and PR objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/preserve-less-options

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@wfxr
wfxr marked this pull request as ready for review August 19, 2026 15:35
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.

don't reset LESS

1 participant