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

Pass command line args through to diff-files in status view #1155

Merged
merged 2 commits into from
Nov 11, 2021

Conversation

koutcher
Copy link
Collaborator

@koutcher koutcher commented Oct 6, 2021

This makes it possible to use tig --ignore-submodules to speed up
the status view for a repo with many submodules.

Closes #1152

This makes it possible to use `tig --ignore-submodules` to speed up
the status view for a repo with many submodules.

Closes jonas#1152
@krobelus
Copy link
Contributor

Looks good. %(cmdlineargs) is passed to both log and diff commands,
so it looks like it is correct to forward it to diff-files.

Adding it only for GIT_DIFF_UNSTAGED_FILES and not for GIT_DIFF_STAGED_FILES
is a bit inconsistent but seems good enough since it doesn't matter for the
submodule issue.
This means that with --ignore-submodules, Enter in the status view no longer
does anything on staged submodules. We could sidestep that by not showing
staged submodules (by adding %(cmdlineargs) to GIT_DIFF_STAGED_FILES too).
That would allow to filter staged hunks with tig -I boilerplate etc.
Probably absolutely not important.

If the only changes in the worktree are unstaged submodules, tig --ignore-submodules
will still show the "Unstaged Changes" in the main view,
but it's empty. Something similar already happens with commands like
tig -I '' that filter away every single hunk via %(cmdlineargs).

@krobelus
Copy link
Contributor

@bentitmus can you test if there are more issues with submodules with this patch?

@koutcher koutcher force-pushed the gh-1152-ignore-submodules branch from dc161f4 to 812292b Compare October 18, 2021 05:56
@krobelus
Copy link
Contributor

Looks good, the overall change is now fairly small which is a good sign. Don't forget to squash the commits before merging

@bentitmus
Copy link

bentitmus commented Oct 28, 2021

Sorry about the delay - I was away. I've tested this and it seems to work as expected (the speed up is considerable (from around 12s to around 2s). Thanks! As you say, it doesn't show the submodule (staged or unstaged), but this is fine. Most likely I will deliberately stage it from the command line or run tig without --ignore-submodules in those cases which are rare.

@koutcher
Copy link
Collaborator Author

Thanks for the feedback.

@koutcher koutcher merged commit 4885101 into jonas:master Nov 11, 2021
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.

Status takes a long time to load with many submodules
3 participants