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

Re: Help creating git alias

From
ESEugene Sajine <euguess@gmail.com>
Date
Oct 31, 2013, 01:26 UTC
Message-ID
<CAPZPVFarK_jKpM2f62mErAmL+mck6EN1QPfHDHqqfJbJ2AfzXg@mail.gmail.com>
In-Reply-To
<xmqq61sebhh3.fsf@gitster.dls.corp.google.com>
On Wed, Oct 30, 2013 at 5:02 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 28 quoted lines
> Eugene Sajine <euguess@gmail.com> writes:
>
>> On Wed, Oct 30, 2013 at 3:57 PM, Ralf Thielow <ralf.thielow@gmail.com> wrote:
>>> lg=!git log --pretty=format:'%h %ad %ae %s' --date=short | sed 's/@\\S*//g'
>>>
>>> should work.
>>
>>
>> It did! thanks! I didn't know that "!sh -c" is not needed
>
> "sh -c" is often used when you pass arguments to your scriptlets,
> e.g. to allow
>
>         git lg master..next
>
> you would want
>
>         sh -c 'git log ... "$@" | sed ...' -
>
> so that
>
>         git lg master..next
>
> turns into
>
>         sh -c 'git log ... "$@" | sed ...' - master..next
>
> which makes $1="master..next" and fed to "git log".
Junio,

That was my initial intention, because I would like to be able to pass parameters like to git log or git blame correctly without the explicit use of $1. Could you please advise about how to make it work with the !sh -c ?

Because the same exact (sed 's/@\\S*//') syntax didn't work with "sh -c".

Thanks, Eugene

Previous: Junio C HamanoNext: Junio C Hamano
Message 7 of 15 in “Help creating git alias”
  1. Eugene SajineOct 30, 2013
  2. Andrew ArdillOct 30, 2013
  3. Eugene SajineOct 30, 2013
  4. Ralf ThielowOct 30, 2013
  5. Eugene SajineOct 30, 2013
  6. Junio C HamanoOct 30, 2013
  7. Eugene SajineOct 31, 2013
  8. Junio C HamanoOct 31, 2013
  9. Eugene SajineOct 31, 2013
  10. David AguilarOct 31, 2013
  11. Junio C HamanoOct 31, 2013
  12. David AguilarOct 31, 2013
  13. Eugene SajineOct 31, 2013
  14. Junio C HamanoOct 31, 2013
  15. Eugene SajineOct 31, 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.