Overview of git2-testing
mastergit2-testing crate provides convenience functions built on top of git2-rs to simplify the generation of Git repositories for unit testing purposes.repository·master·Indexed 12 days ago
https://github.com/gitui-org/gituiA high-performance, terminal-based Git GUI written in Rust. GitUI provides a responsive, keyboard-driven interface for common Git tasks including staging, committing, stashing, log browsing, and branch management, designed to remain fast even in very large repositories. Version 0.28.1.
git2-testing crate provides convenience functions built on top of git2-rs to simplify the generation of Git repositories for unit testing purposes.GitUI is a fast, terminal-based Git GUI designed for keyboard-only control. Key capabilities include:
filetreelist crate is a component of the gitui project designed to manage lists of files visualized as a tree structure. It is specifically optimized for terminal user interfaces where efficient iteration over visible (non-collapsed) elements is required. The crate handles tree state transitions based on discrete inputs such as Up, Down, and Collapse, ensuring the visual representation remains consistent with the underlying data structure.The asyncgit crate is designed to allow using git2 (the Rust bindings for libgit2) within an asynchronous context.
Its primary purpose is to prevent long-running Git operations from blocking the main thread, which is critical for keeping user interfaces (like gitui) responsive. It achieves this by offloading potentially heavy git2 calls onto a thread pool and using crossbeam-channel to notify the caller when an operation has completed.
asyncgit is structured into two main parts:
sync module: Provides convenience wrappers for common Git repository usage patterns.By default, gitui uses a polling mechanism that checks for changes in the working directory every 5 seconds.
If you want faster, event-driven updates, you can use the --watcher flag. This uses a notify-based approach instead of polling. Note that while faster, the notify approach may cause issues on certain platforms, which is why polling is the default.
gitui --watcherWhen a scope finishes, scopetime emits a log entry at the TRACE level. The log format includes the timestamp, log level, file location of the macro call, the measured duration, the scope name, and the source code location of the scope.
Example log output:
19:45:00 [TRACE] (7) scopetime: [scopetime/src/lib.rs:34] scopetime: 2 ms [my_crate::foo] @my_crate/src/bar.rs:5
GitUI allows you to fully customize key bindings by creating a key_bindings.ron file. The configuration uses the Ron file format.
Each binding entry follows the pattern action_name: Some(( code: KeyCode, modifiers: "MODIFIERS")).
code: Uses KeyCode values from the crossterm crate (e.g., Char('h'), F(1)).modifiers: Uses KeyModifiers values from crossterm (e.g., "SHIFT", "CTRL").Depending on your operating system, place the key_bindings.ron file in one of the following locations:
$HOME/.config/gitui/key_bindings.ron$XDG_CONFIG_HOME/gitui/key_bindings.ron$HOME/.config/gitui/key_bindings.ron%APPDATA%/gitui/key_bindings.ron(
move_left: Some(( code: Char('h'), modifiers: "")),
move_right: Some(( code: Char('l'), modifiers: "")),
move_up: Some(( code: Char('k'), modifiers: "")),
move_down: Some(( code: Char('j'), modifiers: "")),
stash_open: Some(( code: Char('l'), modifiers: "")),
open_help: Some(( code: F(1), modifiers: "")),
status_reset_item: Some(( code: Char('U'), modifiers: "SHIFT")),
)Pre-compiled binaries are available on the GitHub Releases page. Supported architectures include:
x86_64 (musl statically linked), aarch64, arm, and armv7.arm64 and x86 (intel)..msi installer package.vi-style keys or to customize your key bindings in any other way, refer to the dedicated configuration guide in KEY_CONFIG.md.You can change how special keys (like enter or shift) are visually represented in the GitUI interface by creating a key_symbols.ron file. This file is loaded from the same configuration directories used for key bindings.
Provide a mapping of the symbol name to its desired string representation. If a symbol is not provided in the file, GitUI uses its defaults (e.g., ⏎ for enter and ⇧ for shift).
$HOME/.config/gitui/key_symbols.ron$XDG_CONFIG_HOME/gitui/key_symbols.ron$HOME/.config/gitui/key_symbols.ron%APPDATA%/gitui/key_symbols.ron(
enter: Some("enter"),
shift: Some("shift-")
)When building from source, you can manage features. The trace-libgit feature enables libgit2 tracing (requires libgit2 to be built with -DENABLE_TRACE=ON).
By default, trace-libgit is enabled. To disable all default features and build a minimal version, use --no-default-features.
# To disable default features (including trace-libgit)
cargo install --no-default-features gituiTo customize the colors of GitUI, create a theme.ron file in your configuration directory. Since version 0.23, you do not need to define the entire theme; you only need to specify the values you wish to override.
Important: Because overrides are used, all values must be wrapped in Some().
$HOME/.config/gitui/theme.ron$XDG_CONFIG_HOME/gitui/theme.ron$HOME/.config/gitui/theme.ron%APPDATA%/gitui/theme.ronYou can also load specific theme files using the -t flag. For example, gitui -t arc.ron will look for the file in your configuration directory (e.g., $HOME/.config/gitui/arc.ron).
(
selection_bg: Some("Blue"),
selection_fg: Some("#ffffff"),
)