Thread (13 messages) flat view 13 messages, 5 authors, 2016-06-15

Re: tig show <commit> not working anymore?

From: Kumar Appaiah <hidden>
Date: 2016-06-15 22:49:34
Subsystem: the rest · Maintainer: Linus Torvalds

Dear Jonas,

On Sun, Sep 19, 2010 at 02:46:22PM -0400, Jonas Fonseca wrote:
quoted
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 <redacted>
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help