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

Re: [PATCH 2/2] completion: enhance "current branch" display

From
Michal Nazarewicz <mina86@tlen.pl>
Date
May 10, 2009, 11:33 UTC
Message-ID
<87my9lnqet.fsf@erwin.mina86.com>
In-Reply-To
<200905101259.07175.j6t@kdbg.org>
Johannes Sixt <j6t@kdbg.org> writes:
Show 9 quoted lines
> On Sonntag, 10. Mai 2009, Junio C Hamano wrote:
>>  				b="$(cut -c1-7 "$g/HEAD" 2>/dev/null)..." ||
>
> While you are here, you could turn this line into
>
> 		{ b=$(< "$g/HEAD") && b=${b:0:7}...; } 2>/dev/null ||
>
> to save a process. $(< foo) is a bash feature and does the same as
> $(cat foo), but faster.

Excuse me this little cavil but how about something that works on other shells as well:

{ read b <$g/HEAD && _b=${b#???????} && b=${b%"$_b"}... && unset _b }
-- 
Best regards,                                         _     _
 .o. | Liege of Serenly Enlightened Majesty of      o' \,=./ `o
 ..o | Computer Science,  Michal "mina86" Nazarewicz   (o o)
 ooo +--<mina86*tlen.pl>--<jid:mina86*jabber.org>--ooO--(_)--Ooo--
Previous: Johannes SixtNext: Johannes Sixt
Message 3 of 5 in “completion: enhance "current branch" display”
  1. 2/2 completion: enhance "current branch" displayJunio C Hamano, May 10, 2009
  2. Johannes SixtMay 10, 2009
  3. Michal NazarewiczMay 10, 2009
  4. Johannes SixtMay 10, 2009
  5. Shawn O. PearceMay 10, 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.