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

Re: tig show <commit> not working anymore?

From
Kumar Appaiah <a.kumar@alumni.iitm.ac.in>
Date
Sep 20, 2010, 04:25 UTC
Message-ID
<20100920042522.GA21880@bluemoon.alumni.iitm.ac.in>
In-Reply-To
<AANLkTinwTSOVfdZkt8CM9DHy9mm9nPt133nvUNjUcQO1@mail.gmail.com>
Dear Jonas,
On Sun, Sep 19, 2010 at 02:46:22PM -0400, Jonas Fonseca wrote:
Show 15 quoted lines
> > Well, I was exploring the code a little, and I could not understand
> > some aspects fully. First, I discovered that the following hack fixes
> > the problem to an extent:
> >
> > [snip]
> >
> > However, I am pretty certain that that is not the intended use of
> > opt_rev_args and ref_commit, and that they should be used in a
> > different way. For example, tig show HEAD^^^..HEAD should show me
> > three commits combined, but it shows me only one, since I haven't run
> > it through rev-list or the like¸ probably.
> 
> You fix is not that far off but to fix the second issue I had to do
> change the function responsible for expanding %(commit). Anyway,
> should be fixed in 0.16.1.

Unfortunately, this has introduced another (albeit minor) bug: it breaks the tree view in some cases. For example:

git clone git://gitorious.org/taggrepper/taggrepper.git
and run tig there, and press `t'. It always gives me a blank tree.

The cause for this is that view->parent is null when the tree view is invoked, but you merely pass !view->parent in the call to format_argv in prepare_io.

A simple patch to fix this is attached below, but you might have other ideas or I might have missed something, or not added sufficient checks for the argv vector.

As always, if I have missed something above, please do let me know.
Thanks!
Kumar
From 1295e58dbb3035bba3ebaf8686dc328b2b457ae2 Mon Sep 17 00:00:00 2001
From: Kumar Appaiah <a.kumar@alumni.iitm.ac.in>
Date: Sun, 19 Sep 2010 23:19:16 -0500
Subject: [PATCH] Add check to fix tree view
---
 tig.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tig.c b/tig.c
index 7bc5daa..08042ec 100644
--- a/tig.c
+++ b/tig.c
@@ -3332,7 +3332,7 @@ static bool
 prepare_io(struct view *view, const char *dir, const char *argv[], bool replace)
 {
 	view->dir = dir;
-	return format_argv(&view->argv, argv, replace, !view->parent);
+	return format_argv(&view->argv, argv, replace, !view->parent && strcmp(argv[1], "ls-tree"));
 }
 
 static bool
-- 
1.7.1
Previous: Jonas FonsecaNext: Jonas Fonseca
Message 12 of 13 in “tig show <commit> not working anymore?”
  1. Kumar AppaiahSep 16, 2010
  2. Stefan NaeweSep 16, 2010
  3. Kumar AppaiahSep 16, 2010
  4. Jonas FonsecaSep 16, 2010
  5. Kumar AppaiahSep 16, 2010
  6. Michael J GruberSep 16, 2010
  7. Stefan NaeweSep 16, 2010
  8. Kumar AppaiahSep 16, 2010
  9. Kumar AppaiahSep 18, 2010
  10. Jonas FonsecaSep 18, 2010
  11. Jonas FonsecaSep 19, 2010
  12. Kumar AppaiahSep 20, 2010
  13. Jonas FonsecaSep 21, 2010

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.