Skip to content

Commit 5a6e67c

Browse files
author
Stephan Dilly
committed
inspect stash commit (closes #121)
1 parent d550e68 commit 5a6e67c

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
## [Unreleased]
88

99
### Added
10+
- Inspect stash commit in detail ([#121](https://github.com/extrawurst/gitui/issues/121))
1011
- Commit Amend (`ctrl+a`) when in commit popup ([#89](https://github.com/extrawurst/gitui/issues/89))
1112

1213
![](assets/amend.gif)

src/keys.rs

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ pub const STASHING_TOGGLE_UNTRACKED: KeyEvent =
5757
pub const STASHING_TOGGLE_INDEX: KeyEvent =
5858
no_mod(KeyCode::Char('i'));
5959
pub const STASH_APPLY: KeyEvent = no_mod(KeyCode::Enter);
60+
pub const STASH_OPEN: KeyEvent = no_mod(KeyCode::Right);
6061
pub const STASH_DROP: KeyEvent =
6162
with_mod(KeyCode::Char('D'), KeyModifiers::SHIFT);
6263
pub const CMD_BAR_TOGGLE: KeyEvent = no_mod(KeyCode::Char('.'));

src/strings.rs

+6
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,12 @@ pub mod commands {
253253
"drop selected stash",
254254
CMD_GROUP_STASHES,
255255
);
256+
///
257+
pub static STASHLIST_INSPECT: CommandText = CommandText::new(
258+
"Inspect [\u{2192}]", //→
259+
"open stash commit details (allows to diff files)",
260+
CMD_GROUP_STASHES,
261+
);
256262

257263
///
258264
pub static LOG_DETAILS_TOGGLE: CommandText = CommandText::new(

src/tabs/stashlist.rs

+14
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ impl StashList {
7373
}
7474
}
7575

76+
fn inspect(&mut self) {
77+
if let Some(e) = self.list.selected_entry() {
78+
self.queue
79+
.borrow_mut()
80+
.push_back(InternalEvent::InspectCommit(e.id));
81+
}
82+
}
83+
7684
///
7785
pub fn drop(id: CommitId) -> bool {
7886
sync::stash_drop(CWD, id).is_ok()
@@ -112,6 +120,11 @@ impl Component for StashList {
112120
selection_valid,
113121
true,
114122
));
123+
out.push(CommandInfo::new(
124+
commands::STASHLIST_INSPECT,
125+
selection_valid,
126+
true,
127+
));
115128
}
116129

117130
visibility_blocking(self)
@@ -127,6 +140,7 @@ impl Component for StashList {
127140
match k {
128141
keys::STASH_APPLY => self.apply_stash(),
129142
keys::STASH_DROP => self.drop_stash(),
143+
keys::STASH_OPEN => self.inspect(),
130144

131145
_ => (),
132146
};

0 commit comments

Comments
 (0)