static enum request 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; switch (request) { case REQ_VIEW_BLAME: case REQ_PARENT: if (!check_blame_commit(blame, TRUE)) break; blame_go_forward(view, blame, request == REQ_PARENT); break; case REQ_BACK: blame_go_back(view); break; case REQ_ENTER: if (!check_blame_commit(blame, FALSE)) break; if (view_is_displayed(VIEW(REQ_VIEW_DIFF)) && !strcmp(blame->commit->id, VIEW(REQ_VIEW_DIFF)->ref)) break; if (string_rev_is_null(blame->commit->id)) { struct view *diff = VIEW(REQ_VIEW_DIFF); const char *diff_parent_argv[] = { GIT_DIFF_BLAME(encoding_arg, opt_diff_context_arg, opt_ignore_space_arg, view->vid) }; const char *diff_no_parent_argv[] = { GIT_DIFF_BLAME_NO_PARENT(encoding_arg, opt_diff_context_arg, opt_ignore_space_arg, view->vid) }; const char **diff_index_argv = *blame->commit->parent_id ? diff_parent_argv : diff_no_parent_argv; open_argv(view, diff, diff_index_argv, NULL, flags); if (diff->pipe) string_copy_rev(diff->ref, NULL_ID); } else { open_view(view, REQ_VIEW_DIFF, flags); } break; default: return request; } return REQ_NONE; }
static enum request refs_request(struct view *view, enum request request, struct line *line) { struct reference *reference = line->data; switch (request) { case REQ_REFRESH: load_refs(TRUE); refresh_view(view); return REQ_NONE; case REQ_ENTER: { const struct ref *ref = reference->ref; const char *all_references_argv[] = { GIT_MAIN_LOG_CUSTOM(encoding_arg, commit_order_arg(), "", refs_is_all(reference) ? "--all" : ref->name, "") }; open_argv(view, &main_view, all_references_argv, NULL, OPEN_SPLIT); return REQ_NONE; } case REQ_JUMP_COMMIT: { int lineno; for (lineno = 0; lineno < view->lines; lineno++) { struct reference *reference = view->line[lineno].data; if (!strncasecmp(reference->ref->id, view->env->search, strlen(view->env->search))) { select_view_line(view, lineno); report_clear(); return REQ_NONE; } } } default: return request; } }