From 6efd60d3b5e8ef7ecf61bda7269670dbd0826106 Mon Sep 17 00:00:00 2001 From: xvchris Date: Thu, 5 Mar 2026 00:06:33 +0800 Subject: [PATCH 1/3] 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 #2868 Fixes #2869 --- src/popups/remotelist.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/popups/remotelist.rs b/src/popups/remotelist.rs index 0630e35fb5..f825cddbdd 100644 --- a/src/popups/remotelist.rs +++ b/src/popups/remotelist.rs @@ -146,12 +146,14 @@ impl Component for RemoteListPopup { } else if key_match( e, self.key_config.keys.update_remote_name, - ) { + ) && self.valid_selection() + { self.rename_remote(); } else if key_match( e, self.key_config.keys.update_remote_url, - ) { + ) && self.valid_selection() + { self.update_remote_url(); } } From 25ab78449603a6ba35ee30aa40478627dcf581fb Mon Sep 17 00:00:00 2001 From: xvchris Date: Fri, 6 Mar 2026 11:46:57 +0800 Subject: [PATCH 2/3] chore: add changelog entry and sort Cargo.toml dependencies --- CHANGELOG.md | 3 +++ Cargo.toml | 13 ++----------- asyncgit/Cargo.toml | 7 +------ 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4aba19c7e0..c989f1de76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Fixed +* fix panic when renaming or updating remote URL with no remotes configured [[@xvchris](https://github.com/xvchris)] ([#2868](https://github.com/gitui-org/gitui/issues/2868)) + ## [0.28.0] - 2025-12-14 **discard changes on checkout** diff --git a/Cargo.toml b/Cargo.toml index 8f07dd34e4..1c7573aefb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -58,10 +58,7 @@ notify = "8" notify-debouncer-mini = "0.7" once_cell = "1" parking_lot_core = "0.9" -ratatui = { version = "0.29", default-features = false, features = [ - 'crossterm', - 'serde', -] } +ratatui = { version = "0.29", default-features = false, features = ['crossterm', 'serde'] } rayon-core = "1.13" ron = "0.12" scopeguard = "1.2" @@ -70,13 +67,7 @@ serde = "1.0" shellexpand = "3.1" simplelog = { version = "0.12", default-features = false } struct-patch = "0.10" -syntect = { version = "5.3", default-features = false, features = [ - "parsing", - "default-syntaxes", - "default-themes", - "plist-load", - "html", -] } +syntect = { version = "5.3", default-features = false, features = ["parsing", "default-syntaxes", "default-themes", "plist-load", "html"] } tui-textarea = "0.7" two-face = { version = "0.4.4", default-features = false } unicode-segmentation = "1.12" diff --git a/asyncgit/Cargo.toml b/asyncgit/Cargo.toml index ff9fb355b4..ca6d7b088d 100644 --- a/asyncgit/Cargo.toml +++ b/asyncgit/Cargo.toml @@ -24,12 +24,7 @@ easy-cast = "0.5" fuzzy-matcher = "0.3" git2 = "0.20" git2-hooks = { path = "../git2-hooks", version = ">=0.6" } -gix = { version = "0.78.0", default-features = false, features = [ - "max-performance", - "revision", - "mailmap", - "status", -] } +gix = { version = "0.78.0", default-features = false, features = ["max-performance", "revision", "mailmap", "status"] } log = "0.4" # git2 = { path = "../../extern/git2-rs", features = ["vendored-openssl"]} # git2 = { git="https://github.com/extrawurst/git2-rs.git", rev="fc13dcc", features = ["vendored-openssl"]} From 5bbe31f646adfbdfbca638d387cb01b1a2723cc9 Mon Sep 17 00:00:00 2001 From: xvchris Date: Fri, 6 Mar 2026 16:40:57 +0800 Subject: [PATCH 3/3] revert: restore original Cargo.toml formatting --- CHANGELOG.md | 2 +- Cargo.toml | 13 +++++++++++-- asyncgit/Cargo.toml | 7 ++++++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c989f1de76..5c1c40fc19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased -### Fixed +### Fixes * fix panic when renaming or updating remote URL with no remotes configured [[@xvchris](https://github.com/xvchris)] ([#2868](https://github.com/gitui-org/gitui/issues/2868)) ## [0.28.0] - 2025-12-14 diff --git a/Cargo.toml b/Cargo.toml index 1c7573aefb..8f07dd34e4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -58,7 +58,10 @@ notify = "8" notify-debouncer-mini = "0.7" once_cell = "1" parking_lot_core = "0.9" -ratatui = { version = "0.29", default-features = false, features = ['crossterm', 'serde'] } +ratatui = { version = "0.29", default-features = false, features = [ + 'crossterm', + 'serde', +] } rayon-core = "1.13" ron = "0.12" scopeguard = "1.2" @@ -67,7 +70,13 @@ serde = "1.0" shellexpand = "3.1" simplelog = { version = "0.12", default-features = false } struct-patch = "0.10" -syntect = { version = "5.3", default-features = false, features = ["parsing", "default-syntaxes", "default-themes", "plist-load", "html"] } +syntect = { version = "5.3", default-features = false, features = [ + "parsing", + "default-syntaxes", + "default-themes", + "plist-load", + "html", +] } tui-textarea = "0.7" two-face = { version = "0.4.4", default-features = false } unicode-segmentation = "1.12" diff --git a/asyncgit/Cargo.toml b/asyncgit/Cargo.toml index ca6d7b088d..ff9fb355b4 100644 --- a/asyncgit/Cargo.toml +++ b/asyncgit/Cargo.toml @@ -24,7 +24,12 @@ easy-cast = "0.5" fuzzy-matcher = "0.3" git2 = "0.20" git2-hooks = { path = "../git2-hooks", version = ">=0.6" } -gix = { version = "0.78.0", default-features = false, features = ["max-performance", "revision", "mailmap", "status"] } +gix = { version = "0.78.0", default-features = false, features = [ + "max-performance", + "revision", + "mailmap", + "status", +] } log = "0.4" # git2 = { path = "../../extern/git2-rs", features = ["vendored-openssl"]} # git2 = { git="https://github.com/extrawurst/git2-rs.git", rev="fc13dcc", features = ["vendored-openssl"]}