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

Re: [PATCH] config: Add new option to open an editor.

From
Jeff King <peff@peff.net>
Date
Feb 4, 2009, 15:18 UTC
Message-ID
<20090204151833.GA6896@sigill.intra.peff.net>
In-Reply-To
<94a0d4530902040703u53a9082fsfa7203b6203bd118@mail.gmail.com>
On Wed, Feb 04, 2009 at 05:03:22PM +0200, Felipe Contreras wrote:
Show 15 quoted lines
> > With this patch, won't I get different behavior from:
> >
> >  git config -e --global
> >
> > versus
> >
> >  git config --global -e
> 
> Just like you get different behavior from:
> 
> git config -l --global
> 
> and
> 
> git config --global -l

Ugh. Personally I consider such interfaces poorly designed. I understand that the general way "git config" works is to have "git config [options] [action]". And when "[action]" is a variable name, or a variable name with a value, it is easy to see what's going on. But when the action looks like an option, it is just confusing that their ordering is important.

However, the interface to "git config" is not going to change, so I think your following existing practice is reasonable here.

_But_ there is one important difference between your "-e" and "-l". In the "-l" case, we detect that there is extra trailing cruft that will be ignored and give a usage message. So "git config -l --global" complains, but "git config -e --global" silently ignores the second argument. I think you just need to add

  if (argc != 2)
    usage(git_config_set_usage);
as the "-l" code does.
-Peff
Previous: Felipe ContrerasNext: Felipe Contreras
Message 11 of 25 in “config: Add new option to open an editor.”
  1. config: Add new option to open an editor.Felipe Contreras, Feb 3, 2009
  2. Johannes SchindelinFeb 3, 2009
  3. Felipe ContrerasFeb 3, 2009
  4. Johannes SchindelinFeb 3, 2009
  5. Felipe ContrerasFeb 3, 2009
  6. config: Add new option to open an editor.Felipe Contreras, Feb 3, 2009
  7. Johannes SchindelinFeb 3, 2009
  8. Felipe ContrerasFeb 3, 2009
  9. Jeff KingFeb 4, 2009
  10. Felipe ContrerasFeb 4, 2009
  11. Jeff KingFeb 4, 2009
  12. Felipe ContrerasFeb 4, 2009
  13. config: Add new option to open an editor.Felipe Contreras, Feb 4, 2009
  14. Junio C HamanoFeb 4, 2009
  15. Felipe ContrerasFeb 4, 2009
  16. Johannes SchindelinFeb 4, 2009
  17. Johannes SchindelinFeb 4, 2009
  18. Felipe ContrerasFeb 7, 2009
  19. Johannes SchindelinFeb 7, 2009
  20. Felipe ContrerasFeb 7, 2009
  21. Junio C HamanoFeb 7, 2009
  22. Felipe ContrerasFeb 7, 2009
  23. config: Add new option to open an editor.Felipe Contreras, Feb 7, 2009
  24. Johannes SchindelinFeb 4, 2009
  25. Felipe ContrerasFeb 4, 2009

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.