Skip to content

Commit

Permalink
Add support for options handling in log and stashes view extrawurst#1661
Browse files Browse the repository at this point in the history


 * Pass SharedOptions to InspectCommitComponent and CompareCommitsComponent
  • Loading branch information
kamillo committed May 7, 2023
1 parent 49cd7ea commit 0fca975
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,15 @@ impl App {
sender,
theme.clone(),
key_config.clone(),
options.clone(),
),
compare_commits_popup: CompareCommitsComponent::new(
&repo,
&queue,
sender,
theme.clone(),
key_config.clone(),
options.clone(),
),
external_editor_popup: ExternalEditorComponent::new(
theme.clone(),
Expand Down
8 changes: 6 additions & 2 deletions src/components/compare_commits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ use super::{
use crate::{
accessors,
keys::{key_match, SharedKeyConfig},
options::SharedOptions,
queue::{InternalEvent, Queue, StackablePopupOpen},
strings,
ui::style::SharedTheme,
};
use anyhow::Result;
use asyncgit::{
sync::{self, diff::DiffOptions, CommitId, RepoPathRef},
sync::{self, CommitId, RepoPathRef},
AsyncDiff, AsyncGitNotification, CommitFilesParams, DiffParams,
DiffType,
};
Expand All @@ -34,6 +35,7 @@ pub struct CompareCommitsComponent {
visible: bool,
key_config: SharedKeyConfig,
queue: Queue,
options: SharedOptions,
}

impl DrawableComponent for CompareCommitsComponent {
Expand Down Expand Up @@ -172,6 +174,7 @@ impl CompareCommitsComponent {
sender: &Sender<AsyncGitNotification>,
theme: SharedTheme,
key_config: SharedKeyConfig,
options: SharedOptions,
) -> Self {
Self {
repo: repo.clone(),
Expand All @@ -194,6 +197,7 @@ impl CompareCommitsComponent {
visible: false,
key_config,
queue: queue.clone(),
options,
}
}

Expand Down Expand Up @@ -256,7 +260,7 @@ impl CompareCommitsComponent {
let diff_params = DiffParams {
path: f.path.clone(),
diff_type: DiffType::Commits(ids),
options: DiffOptions::default(),
options: self.options.borrow().diff_options(),
};

if let Some((params, last)) =
Expand Down
8 changes: 6 additions & 2 deletions src/components/inspect_commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ use super::{
use crate::{
accessors,
keys::{key_match, SharedKeyConfig},
options::SharedOptions,
queue::{InternalEvent, Queue, StackablePopupOpen},
strings,
ui::style::SharedTheme,
};
use anyhow::Result;
use asyncgit::{
sync::{diff::DiffOptions, CommitId, CommitTags, RepoPathRef},
sync::{CommitId, CommitTags, RepoPathRef},
AsyncDiff, AsyncGitNotification, DiffParams, DiffType,
};
use crossbeam_channel::Sender;
Expand Down Expand Up @@ -61,6 +62,7 @@ pub struct InspectCommitComponent {
git_diff: AsyncDiff,
visible: bool,
key_config: SharedKeyConfig,
options: SharedOptions,
}

impl DrawableComponent for InspectCommitComponent {
Expand Down Expand Up @@ -208,6 +210,7 @@ impl InspectCommitComponent {
sender: &Sender<AsyncGitNotification>,
theme: SharedTheme,
key_config: SharedKeyConfig,
options: SharedOptions,
) -> Self {
Self {
queue: queue.clone(),
Expand All @@ -229,6 +232,7 @@ impl InspectCommitComponent {
git_diff: AsyncDiff::new(repo.borrow().clone(), sender),
visible: false,
key_config,
options,
}
}

Expand Down Expand Up @@ -272,7 +276,7 @@ impl InspectCommitComponent {
diff_type: DiffType::Commit(
request.commit_id,
),
options: DiffOptions::default(),
options: self.options.borrow().diff_options(),
};

if let Some((params, last)) =
Expand Down

0 comments on commit 0fca975

Please sign in to comment.