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

Re: [PATCH] help: show manpage for aliased command on git <alias> --help

From
H.Merijn Brand <h.m.brand@xs4all.nl>
Date
Mar 5, 2013, 15:54 UTC
Message-ID
<20130305165453.6077226c@pc09.procura.nl>
In-Reply-To
<5136127C.2090402@viscovery.net>

On Tue, 05 Mar 2013 16:42:52 +0100, Johannes Sixt <j.sixt@viscovery.net> wrote:

Show 27 quoted lines
> Am 3/5/2013 15:44, schrieb Ævar Arnfjörð Bjarmason:
> > Change the semantics of "git <alias> --help" to show the help for the
> > command <alias> is aliased to, instead of just saying:
> > 
> >     `git <alias>' is aliased to `<whatever>'
> > 
> > E.g. if you have "checkout" aliased to "co" you won't get:
> > 
> >     $ git co --help
> >     `git co' is aliased to `checkout'
> > 
> > But will instead get the manpage for git-checkout.
> ...
> >  	alias = alias_lookup(argv[0]);
> >  	if (alias && !is_git_command(argv[0])) {
> > -		printf_ln(_("`git %s' is aliased to `%s'"), argv[0], alias);
> > -		return 0;
> > +		show_help_for = alias;
> > +	} else {
> > +		show_help_for = argv[0];
> >  	}
> 
> This needs a lot more scrutiny. The alias can be more than just a single
> word, and it can even be a shell scriptlet, i.e., not a git command at all.
> 
> It may make sense to show the help of the aliased-to command if the alias
> resolves to just a single word.

A single word that is (already) known to git as being a valid command to do --help with. I which case I fully agree.

-- 
H.Merijn Brand  http://tux.nl   Perl Monger  http://amsterdam.pm.org/
using perl5.00307 .. 5.17   porting perl5 on HP-UX, AIX, and openSUSE
http://mirrors.develooper.com/hpux/        http://www.test-smoke.org/
http://qa.perl.org   http://www.goldmark.org/jeff/stupid-disclaimers/
Previous: Johannes SixtNext: Matthieu Moy
Message 3 of 10 in “help: show manpage for aliased command on git <alias> --help”
  1. help: show manpage for aliased command on git <alias> --helpÆvar Arnfjörð Bjarmason, Mar 5, 2013
  2. Johannes SixtMar 5, 2013
  3. H.Merijn BrandMar 5, 2013
  4. Matthieu MoyMar 5, 2013
  5. Junio C HamanoMar 5, 2013
  6. Ævar Arnfjörð BjarmasonMar 5, 2013
  7. Junio C HamanoMar 5, 2013
  8. Jeff KingMar 5, 2013
  9. Michael J GruberMar 6, 2013
  10. Junio C HamanoMar 6, 2013

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.