Skip to content
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

Can edit in Pager #1243

Merged
merged 1 commit into from
Nov 19, 2022
Merged

Can edit in Pager #1243

merged 1 commit into from
Nov 19, 2022

Conversation

crisisdice
Copy link
Contributor

@crisisdice crisisdice commented Oct 27, 2022

When working with pull requests, before merging to master it is nice to get the total diff of all of the commits of the PR, as in the Files changed tab on github. This is possible with tig, i.e. git diff master | tig or :!git diff master, but currently, this view does not support editing.

This PR makes editing in the pager view possible.

@@ -155,6 +155,9 @@ pager_request(struct view *view, enum request request, struct line *line)
enum open_flags flags = view_is_displayed(view) ? OPEN_SPLIT : OPEN_DEFAULT;
int split = 0;

if (request == REQ_EDIT)
return diff_common_edit(view, request, line);
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like a good change, thanks. This has bothered me occasionally in the past, although I hardly use the pager view (perhaps because of that?).

One thing that's weird in git log -p | tig is that if my cursor is inside a commit message,
:edit will work - searches upwards for the last file in above commit.
I think we should stop the search at a commit boundary, e.g. the commit: line. I guess this is not a blocker.

Can we also make it work for the log view (e.g. tig log -p)?

One more thing: could you put the PR description in the commit message instead? The commit message will make it into the changelog (via git shortlog)

@koutcher
Copy link
Collaborator

Thanks. It will only work when paging diff content but the worst that can happen is a Nothing to edit error message.

@koutcher koutcher merged commit 43a3efa into jonas:master Nov 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants