git-messenger.vim
git-messenger.vim copied to clipboard
Show total number of revisions
I think it would be useful to show the total number of revisions in the History: #0 text:

Something like History: #0 (0/2). What do you think? Thanks!
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.
Ohh I see. If it's too complicated then feel free to close.
@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+.
@toupeira
Nice. (I'm sorry for the delay. I missed to catch the comment) I'll consider to add this functionality.