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

Show total number of revisions #36

Open
petobens opened this issue Jul 13, 2019 · 4 comments
Open

Show total number of revisions #36

petobens opened this issue Jul 13, 2019 · 4 comments

Comments

@petobens
Copy link

I think it would be useful to show the total number of revisions in the History: #0 text:
image

Something like History: #0 (0/2). What do you think? Thanks!

@rhysd
Copy link
Owner

rhysd commented Jul 18, 2019

Thank you for the suggestion.

Yeah, it would be nice to have. However, with current implementation, it requires large code changes and tradeoff.

The history of revisions is a chain of git blame. Based on first source location, git-messenger.vim gets previous revision and source location using git blame. And based on the source location, git-messenger.vim gets older revision and source location using git blame. So it's something like iterating uni-direction linked list.

So git-messenger.vim cannot know the number of revisions under the cursor until it reaches 'no previous revision'. It's possible to fetch all revisions at first :GitMessenger, but it spawns many shell commands and would take time. For those who don't want revisions history, it is a pure overhead.

@petobens
Copy link
Author

Ohh I see. If it's too complicated then feel free to close.

@toupeira
Copy link

@rhysd you don't need to iteratively call git blame, you can get a count directly with e.g. git rev-list --count HEAD <path>. This should match the chain you get from following the blames, though you might also need --no-merges to skip merge commits.

There's still a small performance concern, but it should be fine if this could be called asynchronously, so it doesn't delay the popup. You could also limit the runtime with e.g. --max-count 1001 and display that as 1000+.

@rhysd
Copy link
Owner

rhysd commented Jul 27, 2020

@toupeira

Nice. (I'm sorry for the delay. I missed to catch the comment) I'll consider to add this functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants