git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: To page or not to page

From
Junio C Hamano <gitster@pobox.com>
Date
May 2, 2008, 06:19 UTC
Message-ID
<7vd4o5xm62.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20080502060930.GA1079@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 13 quoted lines
> @@ -267,103 +270,103 @@ static int run_command(struct cmd_struct *p, int argc, const char **argv)
>  	return 0;
>  }
>  
> +static struct cmd_struct commands[] = {
> +	{ "add", cmd_add, RUN_SETUP | NEED_WORK_TREE },
> +	{ "annotate", cmd_annotate, RUN_SETUP },
> +	{ "apply", cmd_apply },
> +	{ "archive", cmd_archive },
> +	{ "blame", cmd_blame, RUN_SETUP },
> +	{ "branch", cmd_branch, RUN_SETUP },
> +	{ "bundle", cmd_bundle },
> +	{ "cat-file", cmd_cat_file, RUN_SETUP },
...
Show 20 quoted lines
> +};
> ...
> @@ -380,6 +383,31 @@ static void handle_internal_command(int argc, const char **argv)
>  	}
>  }
>  
> +void set_command_pager(const char *cmd, int use_pager)
> +{
> +	int i;
> +	for (i = 0; i < ARRAY_SIZE(commands); i++) {
> +		struct cmd_struct *p = commands+i;
> +		if (!strcmp(p->cmd, cmd)) {
> +			if (use_pager)
> +				p->option |= USE_PAGER;
> +			else
> +				p->option &= ~USE_PAGER;
> +			return;
> +		}
> +	}
> +}

Heh, I like it. I briefly thought that pager.cat-file may wreak havoc on scripts, but our pager machanism should be clever enough not to, and cat-file is a valid variable name in the configuration file format ;-).

Previous: Jeff KingNext: Jeff King
Message 19 of 31 in “To page or not to page”
  1. Kevin BallardMay 2, 2008
  2. Jeff KingMay 2, 2008
  3. Junio C HamanoMay 2, 2008
  4. Kevin BallardMay 2, 2008
  5. Junio C HamanoMay 2, 2008
  6. Bart TrojanowskiMay 2, 2008
  7. Pedro MeloMay 2, 2008
  8. Kevin BallardMay 2, 2008
  9. Wincent ColaiutaMay 2, 2008
  10. Jeff KingMay 2, 2008
  11. Pedro MeloMay 2, 2008
  12. Aidan Van DykMay 2, 2008
  13. Wincent ColaiutaMay 2, 2008
  14. Kevin BallardMay 2, 2008
  15. Wincent ColaiutaMay 2, 2008
  16. Jeff KingMay 2, 2008
  17. Johannes SchindelinMay 2, 2008
  18. Jeff KingMay 2, 2008
  19. Junio C HamanoMay 2, 2008
  20. Jeff KingMay 2, 2008
  21. Junio C HamanoMay 2, 2008
  22. Jeff KingMay 5, 2008
  23. Jeff KingMay 6, 2008
  24. Jeff KingMay 6, 2008
  25. Junio C HamanoMay 11, 2008
  26. Jeff KingMay 16, 2008
  27. Jeff KingMay 16, 2008
  28. Johannes SchindelinMay 16, 2008
  29. Jakub NarebskiMay 2, 2008
  30. Jeff KingMay 2, 2008
  31. Jeff KingMay 2, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.