* perf: prevent repeated status fetches in large repos
Replace time-based cache invalidation with a generation counter.
The old `StatusParams` included a millisecond timestamp (tick) in its
hash, causing the cache to invalidate on every UI tick. For large repos
with millions of files, this led to repeated index loading and 5+ minute load times.
This change uses a different strategy to manage cache invalidation:
- Remove tick from StatusParams hash
- Add generation counter that increments after each fetch completes
- Include generation in cache hash
This ensures:
- No repeated fetches while one is already pending, making gitui usable
in large repos
- New fetch starts immediately after completion, keeping gitui responsive
in small repos
- External file changes will still be detected on the next fetch cycle
* fix changelog
---------
Co-authored-by: Daniel Stoll <dstoll@radix.trade>
Co-authored-by: extrawurst <776816+extrawurst@users.noreply.github.com>
Co-authored-by: extrawurst <mail@rusticorn.com>
* fix: guard rename/update_url actions against empty remote list
The rename_remote() and update_remote_url() event handlers in
RemoteListPopup did not check valid_selection() before indexing
into self.remote_names, causing a panic (index out of bounds)
when no remotes are configured.
The delete_remote() handler already had this guard. This commit
adds the same valid_selection() check to the other two handlers
for consistency.
Fixes#2868Fixes#2869
* chore: add changelog entry and sort Cargo.toml dependencies
* revert: restore original Cargo.toml formatting
* fix: disable blame and history popup for untracked files
An untracked file does not have any history data. Right now when
you press `B` for the blame popup or the `H` for the history popup
you get an empty popup where the title spins endlessly trying to find
the file in the commit history, and show relevant information.
This commit disables the two actions in the `StatusTreeComponent`, when the
selected item is a file which is not tracked by git.
---------
Co-authored-by: extrawurst <mail@rusticorn.com>
* Update gix from 0.71.0 to 0.74.1
* Bump MSRC from 1.81 to 1.82
This is required by `gitoxide` 0.74.
* Address clippy issues
* Add getrandom and rustix to deny.toml
* Document reasons for ignoring duplicates
Same as in 1d2248571d for the config
directory, when the cache directory fails to get created for whichever
reason, we currently exit gitui with a pretty undescriptive error.
Improves on #2684.
Fixes#2652.
* Resolve core.hooksPath relative to GIT_WORK_TREE
git supports relative values in core.hooksPath.
`man git-config`:
> A relative path is taken as relative to the directory where the hooks are
> run (see the "DESCRIPTION" section of githooks[5]).
`man githooks`:
> Before Git invokes a hook, it changes its working directory to either
> $GIT_DIR in a bare repository or the root of the working tree in a >
> non-bare repository.
I.e. relative paths in core.hooksPath in non-bare repositories are always
relative to GIT_WORK_TREE.
There is a further exception; I believe this is not considered for path
resolution:
> An exception are hooks triggered during a push (pre-receive, update,
> post-receive, post-update, push-to-checkout) which are always executed
> in $GIT_DIR.
* Favor Repository::workdir() over path().parent()
This more clearly errors in case of bare repositories instead of using
the parent directory of the bare repository.
---------
Co-authored-by: Naseschwarz <naseschwarz@0x53a.de>
Co-authored-by: extrawurst <776816+extrawurst@users.noreply.github.com>
The algorithm for computing marked_consecutive assumes that commits are
consecutive in the commit graph if they are consecutive in the
linearized log used in` commitlist.rs`. That is not universally correct,
as siblings may also be displayed consecutively in this list.
For now, this just removes generating commit lists in dotted range
notation.
Co-authored-by: Naseschwarz <naseschwarz@0x53a.de>
* Copy text using OSC52 if X/Wayland methods fail
* Move Wayland/X string copying out of copy_string
Copying logic seems too nested to comprehend with the introcution of two
paths towards OSC52 otherwise.
---------
Co-authored-by: Naseschwarz <naseschwarz@0x53a.de>
Co-authored-by: extrawurst <776816+extrawurst@users.noreply.github.com>
* Improve syntax detection
Currently, gitui prioritizes file extensions for syntax detection.
When a file lacks an extension (e.g. Makefile), or the extension
isn't tied to a specific format (e.g. .lock), it disables syntax
highlighting. Gitui will now try to detect the syntax from the entire
filename and the first line of the file using find_syntax_for_file().
---------
Co-authored-by: extrawurst <mail@rusticorn.com>