Skip to content

Commit 7484796

Browse files
committed
Jump from blame to commit
Closes #355
1 parent b331077 commit 7484796

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

NEWS.adoc

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ Release notes
44
master
55
------
66

7+
Improvements:
8+
9+
- Jump from blame to commit. (#355)
10+
711
Bug fixes:
812

913
- Fix wrapping of lines with multibyte characters. (#988)

include/tig/argv.h

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ typedef unsigned long argv_number;
6060
struct argv_env {
6161
ARGV_ENV_INFO(ARGV_ENV_FIELDS)
6262
unsigned long goto_lineno;
63+
char goto_id[SIZEOF_REV];
6364
char search[SIZEOF_STR];
6465
char none[1];
6566
};

src/blame.c

+6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "tig/draw.h"
2222
#include "tig/git.h"
2323
#include "tig/diff.h"
24+
#include "tig/main.h"
2425

2526
/*
2627
* Blame backend
@@ -499,6 +500,11 @@ blame_request(struct view *view, enum request request, struct line *line)
499500
}
500501
break;
501502

503+
case REQ_VIEW_MAIN:
504+
string_copy_rev(view->env->goto_id, view->env->commit);
505+
open_main_view(view, OPEN_RELOAD);
506+
break;
507+
502508
default:
503509
return request;
504510
}

src/main.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ main_add_commit(struct view *view, enum line_type type, struct commit *template,
9898

9999
view_column_info_update(view, line);
100100

101-
if (opt_start_on_head && is_head_commit(commit->id))
101+
if ((opt_start_on_head && is_head_commit(commit->id)) ||
102+
(view->env->goto_id[0] && !strncmp(view->env->goto_id, commit->id, SIZEOF_REV - 1)))
102103
select_view_line(view, line->lineno + 1);
103104

104105
return commit;

0 commit comments

Comments
 (0)