Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/blame.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,6 @@ blame_open(struct view *view, enum open_flags flags)
free(blame->commit);
}

if (!(flags & OPEN_RELOAD))
reset_view_history(&blame_view_history);
string_copy_rev(state->history_state.id, view->env->ref);
state->history_state.filename = get_path(view->env->file);
if (!state->history_state.filename)
Expand Down Expand Up @@ -455,6 +453,8 @@ blame_request(struct view *view, enum request request, struct line *line)
enum open_flags flags = view_is_displayed(view) ? OPEN_SPLIT : OPEN_DEFAULT;
struct blame *blame = line->data;
struct view *diff = &diff_view;
struct blame_state *state = view->private;
struct blame_history_state *history_state = &state->history_state;

switch (request) {
case REQ_VIEW_BLAME:
Expand All @@ -476,6 +476,11 @@ blame_request(struct view *view, enum request request, struct line *line)
!strcmp(blame->commit->id, diff->ref))
break;

if (!push_view_history_state(&blame_view_history, &view->pos, history_state)) {
report("Failed to save current view state");
break;
}

if (string_rev_is_null(blame->commit->id)) {
const char *diff_parent_argv[] = {
GIT_DIFF_BLAME(encoding_arg,
Expand Down
2 changes: 1 addition & 1 deletion src/view.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ push_view_history_state(struct view_history *history, struct position *position,

if (state && data && history->state_alloc &&
!memcmp(state->data, data, history->state_alloc))
return NULL;
return state;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Return the current stack when nothing changed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, otherwise reopening the same blame fails.


state = calloc(1, sizeof(*state) + history->state_alloc);
if (!state)
Expand Down