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

Re: [tig] Feeding specific revisions to tig

From
Jonas Fonseca <jonas.fonseca@gmail.com>
Date
Aug 10, 2008, 09:16 UTC
Message-ID
<2c6b72b30808100216j2c719bf2yb7dfba651db901e3@mail.gmail.com>
In-Reply-To
<20080808211916.GA30583@sigill.intra.peff.net>
On Fri, Aug 8, 2008 at 23:19, Jeff King <peff@peff.net> wrote:
Show 25 quoted lines
> On Wed, Aug 06, 2008 at 01:06:51PM +0200, Jonas Fonseca wrote:
>> I actually added something that let's you alter the command executed
>> for each view. So here is another possibility that can be used:
>>
>> function tignowalk ()
>> {
>>    tmp=$(mktemp) # or .git/tigfiles or similar
>>    # Safe stuff from "stdin" and run tig with custom rev-list command
>>    cat > "$tmp
>>    TIG_MAIN_CMD="git rev-list --pretty=raw --no-walk --stdin < $tmp"
>> tig < /dev/tty
>>    rm "$tmp"
>> }
>
> Neat, if a bit hack-ish. :) You are missing a closing quotation mark
> after
>
>  cat > "$tmp
>
> and the line break between TIG_MAIN_CMD and tig is obviously problematic
> (presumably an artifact of the email, but it confused my cut and paste
> efforts for a minute). One other thing to note is that even though you
> try to handle a $tmp with whitespace in the cat and rm commands, I
> suspect it would fail when tig hands TIG_MAIN_CMD to the shell. That
> would require double-quoting.

Yes, this way to "hook" into tig is a bit hackish and gives some problems with handling files. But then again, it is hidden away in env. variables, which seems very effective in not getting it too exposed. :)

Show 9 quoted lines
> So here is my cut-and-pastable version:
>
>  tignowalk() {
>    tmp=$(mktemp)
>    cat >"$tmp"
>    TIG_MAIN_CMD="git rev-list --pretty=raw --no-walk --stdin <$tmp" \
>      tig </dev/tty
>    rm "$tmp"
>  }
Thanks for the fixed up version.
-- 
Jonas Fonseca
Previous: Jeff KingNext: Jean-Baptiste Quenot
Message 7 of 11 in “[tig] Feeding specific revisions to tig”
  1. Jean-Baptiste QuenotJun 4, 2008
  2. Jeff KingJun 4, 2008
  3. Jean-Baptiste QuenotJun 4, 2008
  4. Jeff KingJun 4, 2008
  5. Jonas FonsecaAug 6, 2008
  6. Jeff KingAug 8, 2008
  7. Jonas FonsecaAug 10, 2008
  8. Jean-Baptiste QuenotApr 23, 2009
  9. Jonas FonsecaApr 27, 2009
  10. Jean-Baptiste QuenotApr 28, 2009
  11. Jean-Baptiste QuenotSep 15, 2011

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.