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