-
Notifications
You must be signed in to change notification settings - Fork 616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add navigation between merge commits #525
Conversation
I’ve been wanting this feature since the first time I use tig ;) I consider |
99bde99
to
009fa32
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this contribution. I think it is a nice feature, however, there're a couple of things I think are needed before this can be merged. Let me know if you want me to polish things up.
return error("Unknown search request"); | ||
} | ||
|
||
if (!view->matched_lines && find_merges(view)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will always return ERROR_OUT_OF_MEMORY
when find_merges
succeeds.
break; | ||
|
||
default: | ||
return error("Unknown search request"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this error message should be changed.
@@ -292,6 +292,11 @@ view_driver(struct view *view, enum request request) | |||
find_next(view, request); | |||
break; | |||
|
|||
case REQ_MOVE_NEXT_MERGE: | |||
case REQ_MOVE_PREV_MERGE: | |||
find_merge(view, request); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will segfault on views that does not have a graph. I suggest this only reports an error:
report("Moving between merge commits is not supported by the %s view", view->name);
And the find_merge
cases are moved to main_request
in src/main.c
.
if (!view->ops->get_column_data(view, line, &column_data)) | ||
continue; | ||
|
||
if (!column_data.graph->is_merge(canvas)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
column_data.graph
will be NULL here for all views except main
.
return false; | ||
|
||
view->line[lineno].search_result = true; | ||
view->matched_line[view->matched_lines++] = lineno; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any particular reason to reuse these member that are usually for search highlighting?
···<date: 2016-10-17, Monday>···<from: Jonas Fonseca>···
I very much appreciate the review. I’ll try to have something
No particular reason except to have the code as close to the The two obvious options would be a) to extend Best, |
Fixes a potential NULL deref. As per review: jonas#525 (comment)
Handle merge ops in main view and emit a message when they are encountered outside. As per review: jonas#525 (comment)
…uest Emit an error message that indicates a bad request when looking for merge commits. As per review: jonas#525 (comment)
Find merges by traversing lines directly. Instead of collecting hte merges like matches, the next merge is determined starting from the current line. Whether the search wraps around is controlled by wrap-search. As per review: jonas#525 (comment)
I’ve addressed each of your remarks in a single commit. After review |
Allow skipping forward and backward between merge commits by means of two actions “move-next-merge” and “move-prev-merge”. The search considers all lines containing the merge symbol.
Fixes a potential NULL deref. As per review: jonas#525 (comment)
Handle merge ops in main view and emit a message when they are encountered outside. As per review: jonas#525 (comment)
…uest Emit an error message that indicates a bad request when looking for merge commits. As per review: jonas#525 (comment)
Find merges by traversing lines directly. Instead of collecting hte merges like matches, the next merge is determined starting from the current line. Whether the search wraps around is controlled by wrap-search. As per review: jonas#525 (comment)
Find merges by traversing lines directly. Instead of collecting hte merges like matches, the next merge is determined starting from the current line. Whether the search wraps around is controlled by wrap-search. As per review: jonas#525 (comment)
Thanks squashed and merged. |
Allow skipping forward and backward between merge commits by means of
two actions “move-next-merge” and “move-prev-merge”. The search
considers all lines containing the merge symbol.