git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Martin Ågren" <martin.agren@gmail.com>
To: Matthew Bystrin <dev.mbstr@gmail.com>
Cc: git@vger.kernel.org,
	"Lessley Dennington" <lessleydennington@gmail.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Junio C Hamano" <gitster@pobox.com>,
	"Elijah Newren" <newren@gmail.com>,
	"Phillip Wood" <phillip.wood123@gmail.com>,
	"idriss fekir" <mcsm224@gmail.com>,
	"Joey Salazar" <jgsal@protonmail.com>
Subject: Re: [PATCH] git: fix paginate handling for commands with DELAY_PAGER_CONFIG
Date: Thu, 21 Nov 2024 22:50:59 +0100	[thread overview]
Message-ID: <CAN0heSoryo-DO6WXKqqASJ5nDLqb3PNNiZv1TP=Pq11wsiSM6A@mail.gmail.com> (raw)
In-Reply-To: <20241120101741.8225-1-dev.mbstr@gmail.com>

Hi Matthew,

On Wed, 20 Nov 2024 at 11:41, Matthew Bystrin <dev.mbstr@gmail.com> wrote:
>
> Calling commands using editor in terminal with `--paginate` option will
> break things. For example `git --paginate config --edit`. Add extra
> check to ignore paginate flag in case command have DELAY_PAGER_CONFIG
> set.
>
> Relates: cd878a206e8c (t7006: add tests for how git config paginates)
> Signed-off-by: Matthew Bystrin <dev.mbstr@gmail.com>
> ---

> Some time ago I've sent RFC patch [1], which was not quite ready, and I didn't
> receive any feedback. Now I'm sending a more complete version of it. Fixing
> mentioned behaviour of `note` command can be done in separate patch series.

Thanks for reposting, and welcome to the list.

> +       if (use_pager == 1 && (p->option & DELAY_PAGER_CONFIG))
> +               use_pager = 0;
>         if (run_setup && startup_info->have_repository)

This flag goes back to c409824cc2a ("git.c: let builtins opt for
handling `pager.foo` themselves", 2017-08-02). The original observation
was that setting `pager.tag` to true was more or less foolish -- it
would help `git tag --list`, sure, but would also break `git tag -a`
quite badly along the way since the latter wants to open an editor.

That's why c409824cc2a allowed builtins to basically say "delay pager
config handling -- I'll respect it for some options/modes, but not for
others". Now this proposed patch wants to extend that handling beyond
"delay pager *config*" to even go "for some options/modes, I'm going to
completely ignore `--paginate`." ("Delay pager *option*"?)

Actually, no, it's not so much ignoring as *forcing*. Since you force it
to 0, doesn't that mean that `--paginate` ends up basically being
`--no-pager`? So `git --paginate branch` is now `git --no-pager branch`?
That doesn't seem right. An optionless `git branch` would have
paginated, so adding `--paginate` shouldn't change anything.

But even if we force it to -1 instead (for "maybe"), I'm not sure I
understand why such an undoing of user intention is wanted. If I run
`git --paginate tag -a ...`, maybe that's just self-inflicted harm, but
are we certain that for all the `git foo --bar` which won't respect
`pager.foo`, that it's also completely crazy to provide `--paginate`?

Martin

  reply	other threads:[~2024-11-21 21:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-20 10:17 [PATCH] git: fix paginate handling for commands with DELAY_PAGER_CONFIG Matthew Bystrin
2024-11-21 21:50 ` Martin Ågren [this message]
2024-11-22 17:21   ` Junio C Hamano
2024-11-22 18:13     ` Matthew Bystrin
2024-11-25  2:21       ` Junio C Hamano
2024-11-25 10:55       ` Martin Ågren
2024-11-28 22:27         ` Matthew Bystrin
2024-11-22 18:50 ` Kristoffer Haugsbakk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAN0heSoryo-DO6WXKqqASJ5nDLqb3PNNiZv1TP=Pq11wsiSM6A@mail.gmail.com' \
    --to=martin.agren@gmail.com \
    --cc=avarab@gmail.com \
    --cc=dev.mbstr@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jgsal@protonmail.com \
    --cc=lessleydennington@gmail.com \
    --cc=mcsm224@gmail.com \
    --cc=newren@gmail.com \
    --cc=phillip.wood123@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).