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

feat(attach): Allow attaching to files out of repo #980

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Supremist
Copy link

This will allow to highlight usaved changes in buffer, even if file is not in the git repo. This behaviour needs to be enabled by attach_to_out_of_repo config option (false by default).

Resolves #164

I feel like this may be a little out of scope of this project. But I wanted it myself, and saw other people want it, so I decided to share. I also think this is a small change and should not make any difference by default (needs to be explicitly enabled in user config).
It is of course for the maintainer to decide, and I will understand if PR gets rejected. If you know a better way to do this, I would like to know and help implement it.
Anyway, it is a pleasure to use this plugin, keep up the great work!

This will allow to highlight usaved changes in buffer, even if file is not in the git repo.
This behaviour needs to be enabled by `attach_to_out_of_repo` config option (false by default).

Resolves lewis6991#164
@lewis6991
Copy link
Owner

I'm not sure this is the most robust way to implement this. Ideally when attaching to non-git files, there should be no git_obj in the cache at all.

Also this will cause an error if any hunk for any actions like stage_hunk.

@Supremist
Copy link
Author

I'm not sure this is the most robust way to implement this. Ideally when attaching to non-git files, there should be no git_obj in the cache at all.

I agree. I was aiming for a pretty minimal change, just to do it fast first. I can look into a more robust way of implementing this (without the git_obj). But there will be more changes of course.

Also this will cause an error if any hunk for any actions like stage_hunk.

Yes, it is to be expected. Only a few features will actually work without a git repository. I can list the supported features in documentation for the config option.

In general, is this the feature that you are interested in merging? (when it will be better implemented) So I can know whether or not to put more time into it.

@lewis6991
Copy link
Owner

In general, is this the feature that you are interested in merging? (when it will be better implemented) So I can know whether or not to put more time into it.

Yes if it is done robustly and cleanly and ideally with at least one test.

We should also bikeshed on the config name but let's do that later.

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

Successfully merging this pull request may close these issues.

Show diff for current buffer compared to saved version
2 participants