Skip to content

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

Merged
koutcher merged 2 commits intojonas:masterfrom
koutcher:gh-1152-ignore-submodules
Nov 11, 2021
Merged

Pass command line args through to diff-files in status view#1155
koutcher merged 2 commits intojonas:masterfrom
koutcher:gh-1152-ignore-submodules

Conversation

@koutcher
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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
Copy Markdown
Collaborator Author

Thanks for the feedback.

@koutcher koutcher merged commit 4885101 into jonas:master Nov 11, 2021
@koutcher koutcher deleted the gh-1152-ignore-submodules branch February 6, 2025 18:18
@koutcher koutcher restored the gh-1152-ignore-submodules branch February 6, 2025 18:36
vxsl pushed a commit to vxsl/tig that referenced this pull request Mar 18, 2026
This makes it possible to use `tig --ignore-submodules` to speed up
the status view for a repo with many submodules.

Closes jonas#1152

Reported-by: Benjamin Titmus <ben.titmus@cantab.net>
Reviewed-by: Johannes Altmanninger <aclopte@gmail.com>
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