git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/1] git: pager behaviour
@ 2024-11-04 14:05 Matthew Bystrin
  2024-11-04 14:05 ` [RFC PATCH 1/1] git: ignore paginate for commands with DELAY_PAGER_CONFIG Matthew Bystrin
  0 siblings, 1 reply; 2+ messages in thread
From: Matthew Bystrin @ 2024-11-04 14:05 UTC (permalink / raw)
  To: git

I've recently discovered that launching `--edit` with `--paginate` breaks
everything. Is this an expected behaviour? I proposed a possible solution in
this patch. However it is turned out that situation with pager is more
complicated than expected.

This patch does not fix `notes` command and even does not pass "t7006.24 git tag
-a respects --paginate" test. Interesting point to mention is that `notes edit`
command can be also broken with `-c pager.notes=1`.

Relates: cd878a206e8c (t7006: add tests for how git config paginates) 

Matthew Bystrin (1):
  git: ignore paginate for commands with DELAY_PAGER_CONFIG

 git.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [RFC PATCH 1/1] git: ignore paginate for commands with DELAY_PAGER_CONFIG
  2024-11-04 14:05 [RFC PATCH 0/1] git: pager behaviour Matthew Bystrin
@ 2024-11-04 14:05 ` Matthew Bystrin
  0 siblings, 0 replies; 2+ messages in thread
From: Matthew Bystrin @ 2024-11-04 14:05 UTC (permalink / raw)
  To: git
  Cc: Elijah Newren, Idriss Fekir, Lessley Dennington,
	Ævar Arnfjörð Bjarmason, Junio C Hamano

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-11-04 14:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-04 14:05 [RFC PATCH 0/1] git: pager behaviour Matthew Bystrin
2024-11-04 14:05 ` [RFC PATCH 1/1] git: ignore paginate for commands with DELAY_PAGER_CONFIG Matthew Bystrin

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).