Re: [tig] Feeding specific revisions to tig
- From
Jeff King <peff@peff.net>
- Date
- Aug 8, 2008, 21:19 UTC
- Message-ID
- <20080808211916.GA30583@sigill.intra.peff.net>
- In-Reply-To
- <2c6b72b30808060406u10d7b332g22ea28fe5470ddb1@mail.gmail.com>
On Wed, Aug 06, 2008 at 01:06:51PM +0200, Jonas Fonseca wrote:
> Sorry for restarting this old thread ...
I am glad you got a chance to look at it. :)
Show 12 quoted lines
> 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.
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"
}The output looks great, though. Doing
git show-ref --heads | cut -d' ' -f2 | tignowalk
is nice. :)
Show 6 quoted lines
> The problem is that --no-walk doesn't seem to play nice with the > --boundary flag that tig add by default. When the user requests > --no-walk boundary commits are probably not interesting. My fix below > has more information. I don't know if having only the "commit" line > show up is a bug in git. At least there are no tests to confirm this > or not.
Sorry, I don't know if that is intentional or not.
-Peff