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

Allow url generation for changed files #24

Merged
merged 1 commit into from
Jul 9, 2021
Merged

Conversation

ruifm
Copy link
Owner

@ruifm ruifm commented Jul 7, 2021

Fixes #21

@ruifm ruifm added the bug Something isn't working label Jul 7, 2021
@ruifm ruifm self-assigned this Jul 7, 2021
Comment on lines +89 to +98
if not git.has_file_changed(buf_path, rev) then
range = buffer.get_range(mode, user_opts.add_current_line_on_normal_mode)
elseif mode == "v" or user_opts.add_current_line_on_normal_mode then
print(
string.format(
"No line numbers were computed because '%s' has changes",
buf_path
)
)
end
Copy link
Owner Author

Choose a reason for hiding this comment

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

Here I should also check if the buffer has been modified but not written to.
The downside is that it would fail in the edge case scenario where the buffer is modified, written, and then modified in such a way that it reverts it back to the original state (e.g. using undo), which means that the current buffer contents are unmodified with respect to its remote counterpart, whereas the working directory version is not.

@ruifm ruifm merged commit 9858ec1 into master Jul 9, 2021
@ruifm ruifm deleted the allow-changed-files branch July 9, 2021 15:26
stevanmilic pushed a commit to stevanmilic/gitlinker.nvim that referenced this pull request Nov 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Copy to cliboard fails if the file has changed
1 participant