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

Re: [PATCH] show git tag output in pager

From
Jeff King <peff@peff.net>
Date
Oct 7, 2011, 16:16 UTC
Message-ID
<20111007161648.GA4399@sigill.intra.peff.net>
In-Reply-To
<vpqsjn4dfi4.fsf@bauges.imag.fr>
On Fri, Oct 07, 2011 at 04:48:35PM +0200, Matthieu Moy wrote:
Show 17 quoted lines
> > On Mon, Oct 03, 2011 at 02:57:09PM +0200, Matthieu Moy wrote:
> >
> >> I like the try_subcommand_pager idea. Ideally, there would also be a
> >> nice mechanism to set defaults for subcommands, so that "git tag
> >> <whatever>" does the right thing without configuration.
> >
> > That's easy enough. Something like the patch below?
> 
> It may have been better with a big centralized array of configurations
> like
> 
> 	static struct cmd_struct commands[] = {
> 		{ "add", cmd_add, RUN_SETUP | NEED_WORK_TREE },
>                 ...
> 
> in git.c, but if we have only a few instances of this, your system is
> probably fine. I like it.

I don't think you can centralize it in the same way, because some of it will have to be implemented in shell script (unlike the full-command ones, which we can always trigger at the git.c wrapper layer).

So you could have:
  static struct pager_default subcommands[] = {
          { "tag.list", 1 },
          { "branch.list", 1 },
  };

but you'll never be able to put "stash.list" into that structure (and as you probably guessed, my patch isn't enough to implement stash.list, either; it would need a shell implementation of try_subcommand_pager).

-Peff
Previous: Matthieu Moy
Message 8 of 8 in “show git tag output in pager”
  1. show git tag output in pagerMichal Vyskocil, Sep 27, 2011
  2. Matthieu MoySep 27, 2011
  3. Michal VyskocilSep 29, 2011
  4. Jeff KingSep 30, 2011
  5. Matthieu MoyOct 3, 2011
  6. Jeff KingOct 7, 2011
  7. Matthieu MoyOct 7, 2011
  8. Jeff KingOct 7, 2011

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.