Sertion / vscode-gitblame

Visual Studio Code Extension - See Git Blame info in status bar.
https://marketplace.visualstudio.com/items/waderyan.gitblame
MIT License
72 stars 31 forks source link

[Feature Request] Add support for "git blame --reverse" #113

Closed tommai78101 closed 2 years ago

tommai78101 commented 2 years ago

In Git Blame, there's an option to run --reverse by specifying 2 commit IDs and target a specific file. Since the current Git Blame extension can target specific file via the currently opened / viewed document, I believed it should all work the same here.

The syntax for git blame --reverse is:

git blame --reverse START..END

Walk history forward instead of backward. Instead of showing the revision in which a line appeared, this shows the last revision in which a line has existed. This requires a range of revision like START..END where the path to blame exists in START. git blame --reverse START is taken as git blame --reverse START..HEAD for convenience. START and END are revisions.

Source: https://mirrors.edge.kernel.org/pub/software/scm/git/docs/git-blame.html

I would like to request for this VS Code extension to add support for git blame --reverse.

Thanks.

Sertion commented 2 years ago

Hey Thompson! Thank you for the feature request!

How do you see this working? Should the status bar show information from the earliest commit where it now shows from the oldest commit or should it be a command you can run to see info for the oldest commit in an info message?

The largest issue I can see with making it toggelable is that today everything expects there to only be one blame per line and toggling between two sets would either require a lot of rewrites or a reblame after each toggle. Some blames can take minutes on larger git repos so I would like to avoid that.

tommai78101 commented 2 years ago

There would be a way for the user to enter in 2 revision or commit IDs. The END by default would be commit ID of the current HEAD.

And then once the user clicks "Search" or "OK" or some button, it runs git blame --reverse based on the entered arguments, and then displays the results.

It would be nice to have a default START revision, but I don't know whether it's a good idea to start with the first commit ID of the repository. Might be something that requires the user's input.

Sertion commented 2 years ago

I have given this some thought and I feel it is out of scope for the extension.

It does sound like a good candidate for a new extension if anyone is up for the task.