mirror of
https://github.com/gitui-org/gitui
synced 2026-05-23 00:48:35 +00:00
parent
d5f88df88a
commit
673edd8f2d
12 changed files with 495 additions and 583 deletions
912
Cargo.lock
generated
912
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
42
Cargo.toml
42
Cargo.toml
|
|
@ -17,26 +17,29 @@ keywords = ["git", "gui", "cli", "terminal", "ui"]
|
|||
anyhow = "1.0"
|
||||
asyncgit = { path = "./asyncgit", version = "0.24", default-features = false }
|
||||
backtrace = "0.3"
|
||||
bitflags = "1.3"
|
||||
bitflags = "2.4"
|
||||
bugreport = "0.5"
|
||||
bwrap = { version = "1.3.0", features = ["use_std"] }
|
||||
bwrap = { version = "1.3", features = ["use_std"] }
|
||||
bytesize = { version = "1.3", default-features = false }
|
||||
chrono = { version = "0.4", default-features = false, features = ["clock"] }
|
||||
clap = { version = "4.5", features = ["env", "cargo"] }
|
||||
crossbeam-channel = "0.5"
|
||||
crossterm = { version = "0.26.1", features = ["serde"] }
|
||||
crossterm = { version = "0.27", features = ["serde"] }
|
||||
dirs = "5.0"
|
||||
easy-cast = "0.5"
|
||||
filetreelist = { path = "./filetreelist", version = "0.5" }
|
||||
fuzzy-matcher = "0.3"
|
||||
gh-emoji = { version = "1.0", optional = true }
|
||||
indexmap = "1.9"
|
||||
indexmap = "2"
|
||||
itertools = "0.12"
|
||||
log = "0.4"
|
||||
notify = "5.1"
|
||||
notify-debouncer-mini = "0.2"
|
||||
notify = "6.1"
|
||||
notify-debouncer-mini = "0.4"
|
||||
once_cell = "1"
|
||||
ratatui = { version = "0.21", default-features = false, features = ['crossterm', 'serde'] }
|
||||
ratatui = { version = "0.23", default-features = false, features = [
|
||||
'crossterm',
|
||||
'serde',
|
||||
] }
|
||||
rayon-core = "1.12"
|
||||
ron = "0.8"
|
||||
scopeguard = "1.2"
|
||||
|
|
@ -44,8 +47,13 @@ scopetime = { path = "./scopetime", version = "0.1" }
|
|||
serde = "1.0"
|
||||
shellexpand = "3.1"
|
||||
simplelog = { version = "0.12", default-features = false }
|
||||
struct-patch = "0.2"
|
||||
syntect = { version = "5.0", default-features = false, features = ["parsing", "default-syntaxes", "default-themes", "html"] }
|
||||
struct-patch = "0.4"
|
||||
syntect = { version = "5.2", default-features = false, features = [
|
||||
"parsing",
|
||||
"default-syntaxes",
|
||||
"default-themes",
|
||||
"html",
|
||||
] }
|
||||
unicode-segmentation = "1.11"
|
||||
unicode-truncate = "0.2"
|
||||
unicode-width = "0.1"
|
||||
|
|
@ -53,7 +61,7 @@ which = "4.4"
|
|||
|
||||
[dev-dependencies]
|
||||
pretty_assertions = "1.4"
|
||||
tempfile = "3.4"
|
||||
tempfile = "3"
|
||||
|
||||
[badges]
|
||||
maintenance = { status = "actively-developed" }
|
||||
|
|
@ -69,16 +77,22 @@ trace-libgit = ["asyncgit/trace-libgit"]
|
|||
vendor-openssl = ["asyncgit/vendor-openssl"]
|
||||
|
||||
[workspace]
|
||||
members = ["asyncgit", "filetreelist", "git2-hooks", "git2-testing", "scopetime"]
|
||||
members = [
|
||||
"asyncgit",
|
||||
"filetreelist",
|
||||
"git2-hooks",
|
||||
"git2-testing",
|
||||
"scopetime",
|
||||
]
|
||||
|
||||
[profile.release]
|
||||
lto = true
|
||||
opt-level = 'z' # Optimize for size.
|
||||
opt-level = 'z' # Optimize for size.
|
||||
codegen-units = 1
|
||||
strip = "debuginfo"
|
||||
|
||||
# make debug build as fast as release
|
||||
# usage of utf8 encoding inside tui
|
||||
# make debug build as fast as release
|
||||
# usage of utf8 encoding inside tui
|
||||
# makes their debug profile slow
|
||||
[profile.dev.package."ratatui"]
|
||||
opt-level = 3
|
||||
|
|
|
|||
|
|
@ -12,11 +12,11 @@ categories = ["concurrency", "asynchronous"]
|
|||
keywords = ["git"]
|
||||
|
||||
[dependencies]
|
||||
bitflags = "1"
|
||||
bitflags = "2"
|
||||
crossbeam-channel = "0.5"
|
||||
easy-cast = "0.5"
|
||||
fuzzy-matcher = "0.3"
|
||||
git2 = "0.17"
|
||||
git2 = "0.18"
|
||||
git2-hooks = { path = "../git2-hooks", version = "0.3" }
|
||||
log = "0.4"
|
||||
# git2 = { path = "../../extern/git2-rs", features = ["vendored-openssl"]}
|
||||
|
|
@ -28,15 +28,15 @@ rayon-core = "1.12"
|
|||
scopetime = { path = "../scopetime", version = "0.1" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
thiserror = "1.0"
|
||||
unicode-truncate = "0.2.0"
|
||||
unicode-truncate = "0.2"
|
||||
url = "2.5"
|
||||
|
||||
[dev-dependencies]
|
||||
env_logger = "0.10"
|
||||
env_logger = "0.11"
|
||||
invalidstring = { path = "../invalidstring", version = "0.1" }
|
||||
pretty_assertions = "1.4"
|
||||
serial_test = "1.0"
|
||||
tempfile = "3.4"
|
||||
serial_test = "3.0"
|
||||
tempfile = "3"
|
||||
|
||||
[features]
|
||||
default = ["trace-libgit"]
|
||||
|
|
|
|||
|
|
@ -27,7 +27,8 @@
|
|||
//TODO:
|
||||
#![allow(
|
||||
clippy::significant_drop_tightening,
|
||||
clippy::missing_panics_doc
|
||||
clippy::missing_panics_doc,
|
||||
clippy::multiple_crate_versions
|
||||
)]
|
||||
|
||||
pub mod asyncjob;
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ pub fn diff_contains_file(file_path: String) -> SharedCommitFilterFn {
|
|||
|
||||
bitflags! {
|
||||
///
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct SearchFields: u32 {
|
||||
///
|
||||
const MESSAGE_SUMMARY = 1 << 0;
|
||||
|
|
@ -59,6 +60,7 @@ impl Default for SearchFields {
|
|||
|
||||
bitflags! {
|
||||
///
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct SearchOptions: u32 {
|
||||
///
|
||||
const CASE_SENSITIVE = 1 << 0;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ allow = [
|
|||
"BSD-3-Clause",
|
||||
"CC0-1.0",
|
||||
"ISC",
|
||||
"MPL-2.0"
|
||||
"MPL-2.0",
|
||||
]
|
||||
copyleft = "warn"
|
||||
allow-osi-fsf-free = "neither"
|
||||
|
|
@ -22,5 +22,7 @@ version = "1.0.3"
|
|||
[bans]
|
||||
multiple-versions = "deny"
|
||||
skip-tree = [
|
||||
{ name = "windows-sys" }
|
||||
{ name = "windows-sys" },
|
||||
{ name = "itertools" },
|
||||
{ name = "bitflags" },
|
||||
]
|
||||
|
|
|
|||
|
|
@ -21,4 +21,4 @@ thiserror = "1.0"
|
|||
[dev-dependencies]
|
||||
git2-testing = { path = "../git2-testing" }
|
||||
pretty_assertions = "1.4"
|
||||
tempfile = "3.4"
|
||||
tempfile = "3"
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ categories = ["development-tools"]
|
|||
keywords = ["git"]
|
||||
|
||||
[dependencies]
|
||||
env_logger = "0.10"
|
||||
env_logger = "0.11"
|
||||
git2 = ">=0.17"
|
||||
log = "0.4"
|
||||
tempfile = "3.4"
|
||||
tempfile = "3"
|
||||
|
|
|
|||
|
|
@ -163,11 +163,11 @@ mod tests {
|
|||
NamedTempFile::new_in(&app_home).unwrap();
|
||||
writeln!(
|
||||
temporary_key_list,
|
||||
r"
|
||||
r#"
|
||||
(
|
||||
move_down: Some(( code: Char('j'), modifiers: ( bits: 2,),)),
|
||||
move_down: Some(( code: Char('j'), modifiers: "CONTROL")),
|
||||
)
|
||||
"
|
||||
"#
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
|
|
@ -175,11 +175,11 @@ mod tests {
|
|||
NamedTempFile::new_in(&app_home).unwrap();
|
||||
writeln!(
|
||||
temporary_key_symbols,
|
||||
"
|
||||
r#"
|
||||
(
|
||||
esc: Some(\"Esc\"),
|
||||
esc: Some("Esc"),
|
||||
)
|
||||
"
|
||||
"#
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ impl From<&GituiKeyEvent> for KeyEvent {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Patch)]
|
||||
#[patch_derive(Deserialize)]
|
||||
#[derive(Debug, Clone, Patch)]
|
||||
#[patch_derive(Deserialize, Debug)]
|
||||
pub struct KeysList {
|
||||
pub tab_status: GituiKeyEvent,
|
||||
pub tab_log: GituiKeyEvent,
|
||||
|
|
@ -217,8 +217,11 @@ impl KeysList {
|
|||
pub fn init(file: PathBuf) -> Self {
|
||||
let mut keys_list = Self::default();
|
||||
if let Ok(f) = File::open(file) {
|
||||
if let Ok(patch) = ron::de::from_reader(f) {
|
||||
keys_list.apply(patch);
|
||||
match ron::de::from_reader(f) {
|
||||
Ok(patch) => keys_list.apply(patch),
|
||||
Err(e) => {
|
||||
log::error!("KeysList parse error: {e}");
|
||||
}
|
||||
}
|
||||
}
|
||||
keys_list
|
||||
|
|
@ -248,11 +251,12 @@ mod tests {
|
|||
|
||||
writeln!(
|
||||
file,
|
||||
r"
|
||||
r#"
|
||||
(
|
||||
move_down: Some(( code: Char('j'), modifiers: ( bits: 2,),)),
|
||||
move_down: Some(( code: Char('j'), modifiers: "CONTROL")),
|
||||
move_up: Some((code: Char('h'), modifiers: ""))
|
||||
)
|
||||
"
|
||||
"#
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
|
|
@ -266,5 +270,12 @@ mod tests {
|
|||
KeyModifiers::CONTROL
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
keys.move_up,
|
||||
GituiKeyEvent::new(
|
||||
KeyCode::Char('h'),
|
||||
KeyModifiers::NONE
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use anyhow::Result;
|
||||
use crossbeam_channel::{unbounded, Sender};
|
||||
use notify::{Error, RecommendedWatcher, RecursiveMode, Watcher};
|
||||
use notify_debouncer_mini::{new_debouncer, DebouncedEvent};
|
||||
use notify::{RecommendedWatcher, RecursiveMode, Watcher};
|
||||
use notify_debouncer_mini::{new_debouncer, DebounceEventResult};
|
||||
use scopetime::scope_time;
|
||||
use std::{path::Path, thread, time::Duration};
|
||||
|
||||
|
|
@ -43,9 +43,7 @@ impl RepoWatcher {
|
|||
}
|
||||
|
||||
fn forwarder(
|
||||
receiver: &std::sync::mpsc::Receiver<
|
||||
Result<Vec<DebouncedEvent>, Vec<Error>>,
|
||||
>,
|
||||
receiver: &std::sync::mpsc::Receiver<DebounceEventResult>,
|
||||
sender: &Sender<()>,
|
||||
) -> Result<()> {
|
||||
loop {
|
||||
|
|
@ -68,15 +66,13 @@ impl RepoWatcher {
|
|||
|
||||
fn create_watcher(
|
||||
timeout: Duration,
|
||||
tx: std::sync::mpsc::Sender<
|
||||
Result<Vec<DebouncedEvent>, Vec<Error>>,
|
||||
>,
|
||||
tx: std::sync::mpsc::Sender<DebounceEventResult>,
|
||||
workdir: &str,
|
||||
) {
|
||||
scope_time!("create_watcher");
|
||||
|
||||
let mut bouncer =
|
||||
new_debouncer(timeout, None, tx).expect("Watch create error");
|
||||
new_debouncer(timeout, tx).expect("Watch create error");
|
||||
bouncer
|
||||
.watcher()
|
||||
.watch(Path::new(&workdir), RecursiveMode::Recursive)
|
||||
|
|
|
|||
|
|
@ -6,40 +6,40 @@
|
|||
// Note:
|
||||
// If the default key layout is lower case,
|
||||
// and you want to use `Shift + q` to trigger the exit event,
|
||||
// the setting should like this `exit: Some(( code: Char('Q'), modifiers: ( bits: 1,),)),`
|
||||
// the setting should like this `exit: Some(( code: Char('Q'), modifiers: "SHIFT")),`
|
||||
// The Char should be upper case, and the shift modified bit should be set to 1.
|
||||
//
|
||||
// Note:
|
||||
// find `KeysList` type in src/keys/key_list.rs for all possible keys.
|
||||
// every key not overwritten via the config file will use the default specified there
|
||||
(
|
||||
open_help: Some(( code: F(1), modifiers: ( bits: 0,),)),
|
||||
open_help: Some(( code: F(1), modifiers: "")),
|
||||
|
||||
move_left: Some(( code: Char('h'), modifiers: ( bits: 0,),)),
|
||||
move_right: Some(( code: Char('l'), modifiers: ( bits: 0,),)),
|
||||
move_up: Some(( code: Char('k'), modifiers: ( bits: 0,),)),
|
||||
move_down: Some(( code: Char('j'), modifiers: ( bits: 0,),)),
|
||||
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: "")),
|
||||
|
||||
popup_up: Some(( code: Char('p'), modifiers: ( bits: 2,),)),
|
||||
popup_down: Some(( code: Char('n'), modifiers: ( bits: 2,),)),
|
||||
page_up: Some(( code: Char('b'), modifiers: ( bits: 2,),)),
|
||||
page_down: Some(( code: Char('f'), modifiers: ( bits: 2,),)),
|
||||
home: Some(( code: Char('g'), modifiers: ( bits: 0,),)),
|
||||
end: Some(( code: Char('G'), modifiers: ( bits: 1,),)),
|
||||
shift_up: Some(( code: Char('K'), modifiers: ( bits: 1,),)),
|
||||
shift_down: Some(( code: Char('J'), modifiers: ( bits: 1,),)),
|
||||
popup_up: Some(( code: Char('p'), modifiers: "CONTROL")),
|
||||
popup_down: Some(( code: Char('n'), modifiers: "CONTROL")),
|
||||
page_up: Some(( code: Char('b'), modifiers: "CONTROL")),
|
||||
page_down: Some(( code: Char('f'), modifiers: "CONTROL")),
|
||||
home: Some(( code: Char('g'), modifiers: "")),
|
||||
end: Some(( code: Char('G'), modifiers: "SHIFT")),
|
||||
shift_up: Some(( code: Char('K'), modifiers: "SHIFT")),
|
||||
shift_down: Some(( code: Char('J'), modifiers: "SHIFT")),
|
||||
|
||||
edit_file: Some(( code: Char('I'), modifiers: ( bits: 1,),)),
|
||||
edit_file: Some(( code: Char('I'), modifiers: "SHIFT")),
|
||||
|
||||
status_reset_item: Some(( code: Char('U'), modifiers: ( bits: 1,),)),
|
||||
status_reset_item: Some(( code: Char('U'), modifiers: "SHIFT")),
|
||||
|
||||
diff_reset_lines: Some(( code: Char('u'), modifiers: ( bits: 0,),)),
|
||||
diff_stage_lines: Some(( code: Char('s'), modifiers: ( bits: 0,),)),
|
||||
diff_reset_lines: Some(( code: Char('u'), modifiers: "")),
|
||||
diff_stage_lines: Some(( code: Char('s'), modifiers: "")),
|
||||
|
||||
stashing_save: Some(( code: Char('w'), modifiers: ( bits: 0,),)),
|
||||
stashing_toggle_index: Some(( code: Char('m'), modifiers: ( bits: 0,),)),
|
||||
stashing_save: Some(( code: Char('w'), modifiers: "")),
|
||||
stashing_toggle_index: Some(( code: Char('m'), modifiers: "")),
|
||||
|
||||
stash_open: Some(( code: Char('l'), modifiers: ( bits: 0,),)),
|
||||
stash_open: Some(( code: Char('l'), modifiers: "")),
|
||||
|
||||
abort_merge: Some(( code: Char('M'), modifiers: ( bits: 1,),)),
|
||||
abort_merge: Some(( code: Char('M'), modifiers: "SHIFT")),
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue