threads / announce / 13006

[ANNOUNCE] tig-0.11

Subject: [ANNOUNCE] tig-0.11

## tl;dr

5 messages between Apr 6, 2008 and May 4, 2008.

replies: 4people: 3as markdown or json

Jonas Fonseca· Apr 6, 2008, 20:05 UTC · lore
Hello,

This tig release brings many fixes and improvements to the user interface. Fix pager mode and disable view rely on git directory. The date and author columns as well as references can now be toggled on and off. Local (unsigned) tags are now shown as references and the builtin reference colors have been changed to highlight the current branch and the remote tracked by the current branch. The status and stage views are now reloaded after running external commands (e.g. git commit) so they stay up to date. Finally, add a blame view accessible from the command line (tig blame [rev] file), status view as well as the tree view (by pressing 'B').

Options that were deprecated in 0.10 has been removed except for -S and the old -- handling is also gone. Unless anybody complains tig diff will probably also go, while I am still considering what to do with the log subcommand.

For next release I hope that horizontal scrolling will be fixed. With the recent interest in textual representation of commit graphs, fixing or rewriting tig's graph rendering could also be a good addition.

What is tig? ------------ Tig is a ncurses-based text-mode interface for git. It functions mainly as a git repository browser, but can also act as a pager for output from various git commands.

 Homepage:	http://jonas.nitro.dk/tig/
 Manual:	http://jonas.nitro.dk/tig/manual.html
 Tarballs:	http://jonas.nitro.dk/tig/releases/
 Gitfeed:	git://repo.or.cz/tig.git
 Gitweb:	http://repo.or.cz/w/tig.git

Changes in this release ----------------------- Below is the diffstat and shortlog for changes made in this release.

 TODO          |    5 +-
 VERSION       |    2 +-
 asciidoc.conf |    2 +-
 configure.ac  |   12 +-
 manual.txt    |   10 +-
 tig.1.txt     |   12 +-
 tig.c         | 1652 ++++++++++++++++++++++++++++++++++++++++-----------------
 tigrc.5.txt   |  109 +++--
 8 files changed, 1271 insertions(+), 533 deletions(-)
Dominik Vogt (4):
      New actions toggle-date, toggle-author, and toggle-refs.
      Fixed displaying local tags.
      New config options show-author, show-date, show-refs, show-line-numbers.
      Call realloc() less often because it is potentially slow.
Jonas Fonseca (58):
      0.11.git
      TODO: --boundary flag is already used
      utf8_length: add reserve flag for reserving a trailing character
      draw_text: minor cleanup to use fewer local variables
      draw_text: reduce indentation level
      Fix index refreshing into separate call so diff-files is always run
      configure: test for git binary and improve config subcommand test
      tigrc(5): Improve documentation of new show-* options
      Move unrelated UTF-8 setup code out of parse_options
      Use rewritten parent info from --parents to simplify the revgraph
      draw_text: remove unused col argument
      Simplify subcommand option parsing by moving it out of the loop
      Add hack to allow view loading to have multiple phases
      Add blame view
      Various fixes and improvements of the new blame view
      More blame view fixes
      Remove deprecated options and cleanup option parsing
      blame: Fix opening from subdirectory and consecutive invokations
      Save current branch from rev-parse output and highlight it
      Show the current branch in the status view
      Rename "main-delim" color to the more generic "delimiter"
      Add support for preparing the initial commit in the status view
      Oops, fix delimiter documentation
      Avoid reloading the status view when nothing was updated
      Fix uninitialized variable warning
      Fix and improve status refreshing after updating
      Improve perfomance and usability when updating many files
      stage: disable whitespace warnings from git apply when staging updates
      Fix pager mode by always doing the isatty()
      Disable opening views that require a git directory when in pager mode
      Add action to maximize the current view; bound to M by default
      Add draw_lineno() and use when drawing the blame and pager view
      Show the tracked remote branch with bold text
      Make local tags and normal branches use normal font-weight
      status: use draw_text completely
      Merge branch 'master' of remote-server:src/tig
      Do not load repository references when acting as a pager
      Rename load_repo_config() to load_git_config()
      Share the line number colors between blame view and others
      Use werase() instead of wclear() when reloading a view
      When toggling options redraw the view instead of the whole display
      Add support for refreshing of the stage view
      Reload the status and stage views after a run request has been handled
      Improve staging of diff chunks
      Error out when starting up in empty main or blame view
      Fix compatibility for git rev-parse without --symbolic-full-name
      Revert "When toggling options redraw the view instead of the whole display"
      Use 3 as the minimum width of formatted line numbers
      Avoid splitting the view when navigating stage view in full screen
      Squelsh output of update-index when loading the status view
      Make the main and blame view share date drawing and date colors
      Setup colors for the selected line in draw_view_line()
      Minor cleanup in blame_draw
      Use tables for listing the UI colors
      Remove unused blame line attributes
      Update copyright notice for the manual
      Use sans-serif font for the README page
      tig-0.11
Stefan Naewe (1):
      Output extra \n on tig -h
-- 
Jonas Fonseca
Jeff King· Apr 10, 2008, 04:02 UTC · re: Jonas Fonseca · lore

Re: [ANNOUNCE] tig-0.11

On Sun, Apr 06, 2008 at 10:05:33PM +0200, Jonas Fonseca wrote:
> stay up to date. Finally, add a blame view accessible from the command
> line (tig blame [rev] file), status view as well as the tree view (by
> pressing 'B').
Hi Jonas,

Thanks for all your hard work. I have really been enjoying the new blame view; blame was the only reason I ever used git-gui, and now I can stay in the terminal all the time.

One feature that I have often wanted when using the blame view is to restart the blame from the parent commit of a blamed commit. That is, given a line like:

  2007-08-22 19:36 Jonas Fonseca       776bf2a   15│ #include "config.h"

I look at 776bf2a, and realize that there was some other interesting form of the line _before_ that commit. So I want to start reblaming at 776bf2a^.

Below is an initial attempt at a patch, but it has some problems:
  - the interface is a bit klunky. Since commits may have multiple
    parents, it seemed wrong to always just choose the first parent.
    I chose '1' to reblame from the first parent and '2' from the second
    (and obviously 3-9 could do the same).
    My thought was that the same functionality could be applied to the
    commit viewer to jump to the parent. But maybe grabbing a string and
    appending it to the commit id would make the most sense.
  - it reloads the blame view with new parameters, which will put the
    cursor back at line 1. It would be nice to stay at approximately the
    same line (approximate because the line numbers will change; just
    staying at the same line number makes sense to me).
    I tried a few things, but it looks like we throw out the line
    numbers when we do a reload. I tried saving the line number and
    trying to scroll to it afterwards, but there is some trickery
    required because we have to wait until the view is loaded again. Is
    there any sane way to do this within the current framework?
  - opening a blame view, blaming a parent, and then opening the diff
    viewer can cause a segfault. I assume I'm violating some assumption
    through my open_view() call. Since the patch is only about 15 lines,
    I'm hoping there's something obvious you can comment on.
-Peff
---
diff --git a/tig.c b/tig.c
index a3d2232..7a5497a 100644
--- a/tig.c
+++ b/tig.c
@@ -371,6 +371,8 @@ sq_quote(char buf[SIZEOF_STR], size_t bufsize, const char *src)
 	REQ_(STATUS_MERGE,	"Merge file using external tool"), \
 	REQ_(TREE_PARENT,	"Switch to parent directory in tree view"), \
 	REQ_(EDIT,		"Open in editor"), \
+	REQ_(PARENT_ONE,	"Go to first parent"), \
+	REQ_(PARENT_TWO,	"Go to second parent"), \
 	REQ_(NONE,		"Do nothing")
 
 
@@ -771,6 +773,8 @@ static struct keybinding default_keybindings[] = {
 	{ 'M',		REQ_STATUS_MERGE },
 	{ ',',		REQ_TREE_PARENT },
 	{ 'e',		REQ_EDIT },
+	{ '1',		REQ_PARENT_ONE },
+	{ '2',		REQ_PARENT_TWO },
 
 	/* Using the ncurses SIGWINCH handler. */
 	{ KEY_RESIZE,	REQ_SCREEN_RESIZE },
@@ -3678,6 +3682,32 @@ blame_request(struct view *view, enum request request, struct line *line)
 		open_view(view, REQ_VIEW_DIFF, flags);
 		break;
 
+	case REQ_PARENT_ONE:
+	case REQ_PARENT_TWO:
+		if (!blame->commit) {
+			report("No commit loaded yet");
+			break;
+		}
+
+		if (!strcmp(blame->commit->id, "0000000000000000000000000000000000000000")) {
+			report("No commit selected");
+			break;
+		}
+
+		string_ncopy(opt_ref, blame->commit->id, 40);
+		switch (request) {
+		case REQ_PARENT_ONE:
+			string_add(opt_ref, 40, "^1");
+			break;
+		case REQ_PARENT_TWO:
+			string_add(opt_ref, 40, "^2");
+			break;
+		default:
+			break;
+		}
+		open_view(view, REQ_VIEW_BLAME, flags|OPEN_RELOAD);
+		break;
+
 	default:
 		return request;
 	}
Jonas Fonseca· Apr 10, 2008, 08:56 UTC · re: Jeff King · lore

Re: [ANNOUNCE] tig-0.11

Jeff King <peff@peff.net> wrote Thu, Apr 10, 2008:
Show 7 quoted lines
> On Sun, Apr 06, 2008 at 10:05:33PM +0200, Jonas Fonseca wrote:
> 
> > stay up to date. Finally, add a blame view accessible from the command
> > line (tig blame [rev] file), status view as well as the tree view (by
> > pressing 'B').
> 
> Hi Jonas,
Hello Jeff,
> Thanks for all your hard work.  I have really been enjoying the new
> blame view; blame was the only reason I ever used git-gui, and now I can
> stay in the terminal all the time.
That is great to hear.
Show 9 quoted lines
> One feature that I have often wanted when using the blame view is to
> restart the blame from the parent commit of a blamed commit. That is,
> given a line like:
> 
>   2007-08-22 19:36 Jonas Fonseca       776bf2a   15│ #include "config.h"
> 
> I look at 776bf2a, and realize that there was some other interesting
> form of the line _before_ that commit. So I want to start reblaming at
> 776bf2a^.

The current blame capability is very basic and this sounds like a good idea for extending it.

Show 10 quoted lines
> Below is an initial attempt at a patch, but it has some problems:
> 
>   - the interface is a bit klunky. Since commits may have multiple
>     parents, it seemed wrong to always just choose the first parent.
>     I chose '1' to reblame from the first parent and '2' from the second
>     (and obviously 3-9 could do the same).
> 
>     My thought was that the same functionality could be applied to the
>     commit viewer to jump to the parent. But maybe grabbing a string and
>     appending it to the commit id would make the most sense.

Either that or there could be an option to show parent commit lines in the diff view à la gitk:

	Parent: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa (Do something)
	Parent: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb (Do something else)

and then make pressing 'B' on one of them start it. At least this should solve the problem of having the option for all parents. Using '1', '2', ... or '^' + a number could still work as a short hand.

Show 10 quoted lines
>   - it reloads the blame view with new parameters, which will put the
>     cursor back at line 1. It would be nice to stay at approximately the
>     same line (approximate because the line numbers will change; just
>     staying at the same line number makes sense to me).
> 
>     I tried a few things, but it looks like we throw out the line
>     numbers when we do a reload. I tried saving the line number and
>     trying to scroll to it afterwards, but there is some trickery
>     required because we have to wait until the view is loaded again. Is
>     there any sane way to do this within the current framework?

There is currently no way to do this. Some views have their own hacks to restore the position. But a general way to preserve the position in a view across reloads is something that will come in handy for the status and staging area as well.

>   - opening a blame view, blaming a parent, and then opening the diff
>     viewer can cause a segfault. I assume I'm violating some assumption
>     through my open_view() call. Since the patch is only about 15 lines,
>     I'm hoping there's something obvious you can comment on.

Oops. I will look into it when I get more time. Thanks for the ideas and the clean patch.

-- 
Jonas Fonseca
Pascal Obry· May 3, 2008, 21:11 UTC · re: Jonas Fonseca · lore

Re: [ANNOUNCE] tig-0.11

Jonas,

I see that the '@' key can now move from chunk to chunk. This is nice but it would be more user friendly if after staging a hunk the cursor was not moved to the first line! I think it would be better to have the cursor on top of the next hunk.

Pascal.
-- 
--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595
Jonas Fonseca· May 4, 2008, 19:02 UTC · re: Pascal Obry · lore

Re: [ANNOUNCE] tig-0.11

Hello Pascal,
Pascal Obry <pascal@obry.net> wrote Sat, May 03, 2008:
> I see that the '@' key can now move from chunk to chunk. This is nice but 
> it would be more user friendly if after staging a hunk the cursor was not 
> moved to the first line! I think it would be better to have the cursor on 
> top of the next hunk.
Great that you noticed.

About your suggestion, Jeff suggested something similar for the blame view when jumping to parents ealier in this thread. I will put in the TODO list an entry about adding a general mechanism for saving and restoring states across reloads and refreshes. The status and tree views already have something like this and the stage and blame view are good candidates as well. When the main view will support refreshing there will be one more potential user.

-- 
Jonas Fonseca

← back to recent threads