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

Support line ranges in :Gbrowse for commits #36

Open
odnoletkov opened this issue Jan 8, 2019 · 4 comments
Open

Support line ranges in :Gbrowse for commits #36

odnoletkov opened this issue Jan 8, 2019 · 4 comments

Comments

@odnoletkov
Copy link

It would be great to have :{range}Gbrowse working for commit objects. Especially useful for doing code reviews.

Sample URL:

https://github.com/tpope/vim-rhubarb/commit/b6cbbb0ad3e22870a3cd8d79a22722c63d98d18b#diff-fa7310c9e56a98e1e812ae6c04353771R43

Anchor format is:

#diff-<md5 of path>[L|R]<line number>

with L line number is relative to the origin, with R to the result

Couldn't find a way to select a range in this view, for selected range can either route to the first line or to the cursor position.

As far as I understand for commit fugitive currently doesn't provide path and line numbers, changing that should be most of the work.

@tpope
Copy link
Owner

tpope commented Jan 8, 2019

The basic logic for figuring out the diff line can be found in s:StageInfo(). I'd recommend duplicating it as a starting point. (Don't try to DRY it up.)

If a range is given, I'd say just use the first line of it, regardless of where the cursor is.

odnoletkov added a commit to odnoletkov/vim-rhubarb that referenced this issue Feb 10, 2019
Anchor format is

   #diff-<MD5 of path>[L|R]<line number>

With L line number is relative to the --- side, with R to the +++ side.
Path of the +++ side used when it exists, otherwise path of the --- side
(for removals).

Closes tpope#36
odnoletkov added a commit to odnoletkov/vim-rhubarb that referenced this issue Aug 21, 2019
Anchor format is:

   #diff-<MD5 of path>[[L|R]<start line number>[-[L|R]<end line number>]]

With L line number is relative to the '---' side, and R to the '+++'
side of the diff.  Path of the '+++' side used when it exists, otherwise
path of the '---' side (for removals).

Closes tpope#36
odnoletkov added a commit to odnoletkov/vim-rhubarb that referenced this issue Aug 22, 2019
Anchor format is:

   #diff-<MD5 of path>[[L|R]<start line number>[-[L|R]<end line number>]]

With L line number is relative to the '---' side, and R to the '+++'
side of the diff.  Path of the '+++' side used when it exists, otherwise
path of the '---' side (for removals).

Closes tpope#36
@lucasdf
Copy link

lucasdf commented Sep 18, 2019

hey @odnoletkov , it seems you implemented something like this in your fork. Are you planning to integrate it into the plugin?

@odnoletkov
Copy link
Author

See #37

@tpope
Copy link
Owner

tpope commented Sep 18, 2019

Note the linked Fugitive PR is a prerequisite and the current bottleneck.

odnoletkov added a commit to odnoletkov/vim-rhubarb that referenced this issue Sep 18, 2019
Anchor format is:

   #diff-<MD5 of path>[[L|R]<start line number>[-[L|R]<end line number>]]

With L line number is relative to the '---' side, and R to the '+++'
side of the diff.  Path of the '+++' side used when it exists, otherwise
path of the '---' side (for removals).

Closes tpope#36
odnoletkov added a commit to odnoletkov/vim-rhubarb that referenced this issue Apr 6, 2021
Anchor format is:

   #diff-<SHA256 of path>[[L|R]<start line number>[-[L|R]<end line number>]]

With L line number is relative to the '---' side, and R to the '+++'
side of the diff.  Path of the '+++' side used when it exists, otherwise
path of the '---' side (for removals).

Closes tpope#36
odnoletkov added a commit to odnoletkov/vim-rhubarb that referenced this issue Apr 7, 2021
Anchor format is:

   #diff-<SHA256 of path>[[L|R]<start line number>[-[L|R]<end line number>]]

With L line number is relative to the '---' side, and R to the '+++'
side of the diff.  Path of the '+++' side used when it exists, otherwise
path of the '---' side (for removals).

Closes tpope#36
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

No branches or pull requests

3 participants