git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Bystrin <dev.mbstr@gmail.com>
To: git@vger.kernel.org
Cc: "Elijah Newren" <newren@gmail.com>,
	"Idriss Fekir" <mcsm224@gmail.com>,
	"Lessley Dennington" <lessleydennington@gmail.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Junio C Hamano" <gitster@pobox.com>
Subject: [RFC PATCH 1/1] git: ignore paginate for commands with DELAY_PAGER_CONFIG
Date: Mon,  4 Nov 2024 17:05:36 +0300	[thread overview]
Message-ID: <20241104140536.4970-2-dev.mbstr@gmail.com> (raw)
In-Reply-To: <20241104140536.4970-1-dev.mbstr@gmail.com>

Calling commands using editor in terminal with `--paginate` option break
things. For example `git --paginate config --edit`. Add extra check to
ignore paginate flag in case command have DELAY_PAGER_CONFIG set.

Signed-off-by: Matthew Bystrin <dev.mbstr@gmail.com>
---
 git.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/git.c b/git.c
index c2c1b8e22c..2b3b049f4a 100644
--- a/git.c
+++ b/git.c
@@ -464,11 +464,12 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv, struct
 	}
 	assert(!prefix || *prefix);
 	precompose_argv_prefix(argc, argv, NULL);
-	if (use_pager == -1 && run_setup &&
-		!(p->option & DELAY_PAGER_CONFIG))
+	if (use_pager == -1 && run_setup && !(p->option & DELAY_PAGER_CONFIG))
 		use_pager = check_pager_config(p->cmd);
 	if (use_pager == -1 && p->option & USE_PAGER)
 		use_pager = 1;
+	if (use_pager == 1 && (p->option & DELAY_PAGER_CONFIG))
+		use_pager = 0;
 	if (run_setup && startup_info->have_repository)
 		/* get_git_dir() may set up repo, avoid that */
 		trace_repo_setup();
-- 
2.43.0


      reply	other threads:[~2024-11-04 14:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-04 14:05 [RFC PATCH 0/1] git: pager behaviour Matthew Bystrin
2024-11-04 14:05 ` Matthew Bystrin [this message]

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=20241104140536.4970-2-dev.mbstr@gmail.com \
    --to=dev.mbstr@gmail.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=lessleydennington@gmail.com \
    --cc=mcsm224@gmail.com \
    --cc=newren@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).