-
-
Notifications
You must be signed in to change notification settings - Fork 299
Feature: fast commits for large repositories #1857
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
base: master
Are you sure you want to change the base?
Conversation
CKolkey
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there might be ways to accomplish what you are trying to do without needing to modify much. Do you mind trying my suggestions and letting me know if they work for your use case?
| if not git.status.anything_staged() and not allow_empty(popup) then | ||
| notification.warn("No changes to commit.") | ||
| return | ||
| if not config.values.commit_editor.fast then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also modify the git.status.anything_staged() implementation to check git.repo.state.staged.items[1] ~= nil if "fast" is set to true. Then we don't need to skip this check, but instead just rely on the repo state data already in memory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also put not allow_empty(popup) before git.status.anything_changed(), so you could short-circuit the conditional by enabling "--allow-empty".
|
|
||
| local function do_commit(popup, cmd) | ||
| client.wrap(cmd.arg_list(popup:get_arguments()), { | ||
| cmd.arg_list(popup:get_arguments()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tried just adding an option for -m to the commit popup?
You could do popup:option("m", "message", "", "Commit message", { key_prefix = "-" }) and that also just bypasses the editor.
Lines 2267 to 2283 in d2a2ae4
| Customizing Popups *neogit_custom_popups* | |
| You can customize existing popups via the Neogit config. | |
| Below is an example of adding a custom switch, but you can use any function | |
| from the builder API. | |
| >lua | |
| require("neogit").setup({ | |
| builders = { | |
| NeogitPushPopup = function(builder) | |
| builder:switch('m', 'merge_request.create', 'Create merge request', { cli_prefix = '-o ', persisted = false }) | |
| end, | |
| }, | |
| }) | |
| Keep in mind that builder hooks are executed at the end of the popup | |
| builder, so any switches or options added will be placed at the end. |
I am currently working exclusively with a large codebase. The main issue is that git status on the entire repo takes around 2 seconds which makes staging and committing super tedious and frustrating.
This implementation removes 2
git statuscalls before the commit message editor is shown.The solution is not quite as pretty, so I added a configuration option.