Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

diff pager not respected when using delta as diff command #4205

Open
Uroc327 opened this issue Jan 12, 2025 · 8 comments · May be fixed by #4207
Open

diff pager not respected when using delta as diff command #4205

Uroc327 opened this issue Jan 12, 2025 · 8 comments · May be fixed by #4207
Labels
support Support request

Comments

@Uroc327
Copy link

Uroc327 commented Jan 12, 2025

Describe the bug

By setting diff.pager to less, chezmoi diff gives me one pager including all diffs for all targets. When I do the same when using delta as diff.command, no paging happens.

To reproduce

Using the config

[diff]
    command = "delta"
    args = ["--keep-plus-minus-markers", "--paging", "never"]
    pager = "less"

and executing chezmoi diff when there are multiple files containing changes (larger than one screen).

Expected behavior

I would like to see one single pager containing all the accumulated outputs of the individual delta outputs.

Output of chezmoi doctor

$ chezmoi doctor
RESULT    CHECK                       MESSAGE
ok        version                     v2.57.0, commit v2.57.0, built at 2025-01-06, built by xbps
ok        latest-version              v2.57.0
ok        os-arch                     linux/amd64 (Void)
ok        uname                       Linux TUEILNT-MO-CR2 6.12.9_1 #1 SMP PREEMPT_DYNAMIC Fri Jan 10 00:53:27 UTC 2025 x86_64 GNU/Linux
ok        go-version                  go1.23.4 (gc)
ok        executable                  /usr/bin/chezmoi
ok        config-file                 ~/.config/chezmoi/chezmoi.toml, last modified 2025-01-13T00:33:17+01:00
warning   source-dir                  ~/.local/share/chezmoi is a git working tree (dirty)
ok        suspicious-entries          no suspicious entries
warning   working-tree                ~/.local/share/chezmoi is a git working tree (dirty)
ok        dest-dir                    ~ is a directory
ok        umask                       022
ok        cd-command                  found /usr/bin/zsh
ok        cd-args                     /usr/bin/zsh
ok        diff-command                found /usr/bin/delta
ok        edit-command                found /usr/bin/nvim
ok        edit-args                   /usr/bin/nvim
ok        git-command                 found /usr/bin/git, version 2.47.1
ok        merge-command               found /usr/bin/nvim
ok        shell-command               found /usr/bin/zsh
ok        shell-args                  /usr/bin/zsh
info      age-command                 age not found in $PATH
ok        gpg-command                 found /usr/bin/gpg, version 2.4.5
info      pinentry-command            not set
info      1password-command           op not found in $PATH
info      bitwarden-command           bw not found in $PATH
info      bitwarden-secrets-command   bws not found in $PATH
info      dashlane-command            dcli not found in $PATH
info      doppler-command             doppler not found in $PATH
info      gopass-command              gopass not found in $PATH
ok        keepassxc-command           found /usr/bin/keepassxc-cli, version 2.7.9
info      keepassxc-db                not set
info      keeper-command              keeper not found in $PATH
info      lastpass-command            lpass not found in $PATH
info      pass-command                pass not found in $PATH
info      passhole-command            ph not found in $PATH
info      rbw-command                 rbw not found in $PATH
info      vault-command               vault not found in $PATH
info      vlt-command                 vlt not found in $PATH
info      secret-command              not set

Additional context

I also tried settings diff.pager to delta as well. In fact, setting diff.pager to rev or more doesn't make any difference either.

For completeness (even though I doesn't seem to make a difference in my trials), I have set

$ echo $LESS
-F -R
@KapJI
Copy link
Contributor

KapJI commented Jan 13, 2025

Delta pager is configured in [delta] section in .gitconfig:

[delta]
pager = "ov -F"

Also paging may be not used because of -F flag. From man less:

-F or --quit-if-one-screen
              Causes less to automatically exit if the entire file can be displayed on the first screen.

@Uroc327
Copy link
Author

Uroc327 commented Jan 13, 2025

I don't see how this applies. As far as I understand, I don't want to configure delta (being the tool that generates the diffs per file). This part works fine, I believe. I obtain unpaged, nicely colored outputs for each individual file from chezmoi diff. I would like to see this whole, complete output containing all files to be paged. Essentially, I want chezmoi diff | less. As this is not required with the default diff/pager config, I assume there is either a bug in my chezmoi.toml or in chezmoi.

@twpayne
Copy link
Owner

twpayne commented Jan 13, 2025

@twpayne twpayne added the support Support request label Jan 13, 2025
@Uroc327
Copy link
Author

Uroc327 commented Jan 13, 2025

The

[diff]
    command = "delta"
    pager = "delta"

part you mean? I tried that as well and observed the same behavior.

My .gitconfig does not contain a [delta] section, if that helps.

@KapJI
Copy link
Contributor

KapJI commented Jan 13, 2025

I'm not sure why it needs to be set as both diff.command and diff.pager.

In my case I have delta set as diff.pager only and it works as @Uroc327 seeks. For Git delta is configured the similar way, as pager, not as diff command. It takes regular diff and reformats it. If configured, it uses pager itself.

@KapJI KapJI linked a pull request Jan 13, 2025 that will close this issue
@KapJI
Copy link
Contributor

KapJI commented Jan 13, 2025

Created #4207 to reflect this in docs.

@Uroc327
Copy link
Author

Uroc327 commented Jan 13, 2025

Thanks!
Setting

[diff]
	pager = "delta --keep-plus-minus-markers"

in chezmoi.toml works.

@twpayne
Copy link
Owner

twpayne commented Jan 14, 2025

Please read #4207 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support Support request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants