Skip to content

Commit 5256db6

Browse files
committed
Add support for options handling in log and stashes views gitui-org#1661
* Pass SharedOptions to InspectCommitComponent and CompareCommitsComponent
1 parent 49cd7ea commit 5256db6

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5050
* crashes on entering submodules ([#1510](https://github.com/extrawurst/gitui/issues/1510))
5151
* fix race issue: revlog messages sometimes appear empty ([#1473](https://github.com/extrawurst/gitui/issues/1473))
5252
* default to tick-based updates [[@cruessler](https://github.com/cruessler)] ([#1444](https://github.com/extrawurst/gitui/issues/1444))
53+
* add support for options handling in log and stashes views ([#1661](https://github.com/extrawurst/gitui/issues/1661))
5354

5455
### Changed
5556
* minimum supported rust version bumped to 1.64 (thank you `clap`)

src/app.rs

+2
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,15 @@ impl App {
180180
sender,
181181
theme.clone(),
182182
key_config.clone(),
183+
options.clone(),
183184
),
184185
compare_commits_popup: CompareCommitsComponent::new(
185186
&repo,
186187
&queue,
187188
sender,
188189
theme.clone(),
189190
key_config.clone(),
191+
options.clone(),
190192
),
191193
external_editor_popup: ExternalEditorComponent::new(
192194
theme.clone(),

src/components/compare_commits.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ use super::{
66
use crate::{
77
accessors,
88
keys::{key_match, SharedKeyConfig},
9+
options::SharedOptions,
910
queue::{InternalEvent, Queue, StackablePopupOpen},
1011
strings,
1112
ui::style::SharedTheme,
1213
};
1314
use anyhow::Result;
1415
use asyncgit::{
15-
sync::{self, diff::DiffOptions, CommitId, RepoPathRef},
16+
sync::{self, CommitId, RepoPathRef},
1617
AsyncDiff, AsyncGitNotification, CommitFilesParams, DiffParams,
1718
DiffType,
1819
};
@@ -34,6 +35,7 @@ pub struct CompareCommitsComponent {
3435
visible: bool,
3536
key_config: SharedKeyConfig,
3637
queue: Queue,
38+
options: SharedOptions,
3739
}
3840

3941
impl DrawableComponent for CompareCommitsComponent {
@@ -172,6 +174,7 @@ impl CompareCommitsComponent {
172174
sender: &Sender<AsyncGitNotification>,
173175
theme: SharedTheme,
174176
key_config: SharedKeyConfig,
177+
options: SharedOptions,
175178
) -> Self {
176179
Self {
177180
repo: repo.clone(),
@@ -194,6 +197,7 @@ impl CompareCommitsComponent {
194197
visible: false,
195198
key_config,
196199
queue: queue.clone(),
200+
options,
197201
}
198202
}
199203

@@ -256,7 +260,7 @@ impl CompareCommitsComponent {
256260
let diff_params = DiffParams {
257261
path: f.path.clone(),
258262
diff_type: DiffType::Commits(ids),
259-
options: DiffOptions::default(),
263+
options: self.options.borrow().diff_options(),
260264
};
261265

262266
if let Some((params, last)) =

src/components/inspect_commit.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ use super::{
66
use crate::{
77
accessors,
88
keys::{key_match, SharedKeyConfig},
9+
options::SharedOptions,
910
queue::{InternalEvent, Queue, StackablePopupOpen},
1011
strings,
1112
ui::style::SharedTheme,
1213
};
1314
use anyhow::Result;
1415
use asyncgit::{
15-
sync::{diff::DiffOptions, CommitId, CommitTags, RepoPathRef},
16+
sync::{CommitId, CommitTags, RepoPathRef},
1617
AsyncDiff, AsyncGitNotification, DiffParams, DiffType,
1718
};
1819
use crossbeam_channel::Sender;
@@ -61,6 +62,7 @@ pub struct InspectCommitComponent {
6162
git_diff: AsyncDiff,
6263
visible: bool,
6364
key_config: SharedKeyConfig,
65+
options: SharedOptions,
6466
}
6567

6668
impl DrawableComponent for InspectCommitComponent {
@@ -208,6 +210,7 @@ impl InspectCommitComponent {
208210
sender: &Sender<AsyncGitNotification>,
209211
theme: SharedTheme,
210212
key_config: SharedKeyConfig,
213+
options: SharedOptions,
211214
) -> Self {
212215
Self {
213216
queue: queue.clone(),
@@ -229,6 +232,7 @@ impl InspectCommitComponent {
229232
git_diff: AsyncDiff::new(repo.borrow().clone(), sender),
230233
visible: false,
231234
key_config,
235+
options,
232236
}
233237
}
234238

@@ -272,7 +276,7 @@ impl InspectCommitComponent {
272276
diff_type: DiffType::Commit(
273277
request.commit_id,
274278
),
275-
options: DiffOptions::default(),
279+
options: self.options.borrow().diff_options(),
276280
};
277281

278282
if let Some((params, last)) =

0 commit comments

Comments
 (0)