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

Re: [PATCH 3/3] help: respect aliases

From
Jay Soffian <jaysoffian@gmail.com>
Date
Feb 26, 2008, 20:31 UTC
Message-ID
<76718490802261231j61e66f91r473401e42816cceb@mail.gmail.com>
In-Reply-To
<7vve4b4gqu.fsf@gitster.siamese.dyndns.org>
On Tue, Feb 26, 2008 at 3:14 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 7 quoted lines
>
>  Sure.  The combination of expand, sed, and gnused hurts my eyes
>  ;-)
>
>  One good lesson to take home is that by ending your lines with
>  '|', you can tell the shell that you are not done with the
>  pipeline you are forming yet.

The backslashes aren't there for the shell, they are there for the git config parser. Anyway, I reworked it a bit:

alias = "! sh -c 'case $# in \
               0) git config --get-regexp \"^alias\\.\" \
                  | sort | sed \"s/^alias\\.//; s/=/ /\" \
                  | while read n v; do \
                     printf \"%-16s\" \"$n\"; \
                     echo \"$v\" | fmt -sw 63 | sed \"2,$ s/^/\t\t/\" ;\
                  done ;; \
               1) git config \"alias.$1\" | fmt -sw 78 ;; esac' -"
And yes, it's still ugly.
Always happy to have folks help me bikeshed my git config. :-)
j.
Previous: Junio C Hamano
Message 12 of 12 in “help: use parseopt”
  1. 1/3 help: use parseoptJeff King, Feb 24, 2008
  2. Christian CouderFeb 25, 2008
  3. Jeff KingFeb 25, 2008
  4. Junio C HamanoFeb 25, 2008
  5. 2/3 make alias lookup a public, procedural functionJeff King, Feb 24, 2008
  6. 3/3 help: respect aliasesJeff King, Feb 24, 2008
  7. Jay SoffianFeb 25, 2008
  8. Johannes SchindelinFeb 26, 2008
  9. Jay SoffianFeb 26, 2008
  10. Johannes SchindelinFeb 26, 2008
  11. Junio C HamanoFeb 26, 2008
  12. Jay SoffianFeb 26, 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.