Disable Git panel button to open commit editor in certain cases (#26000)
Also: - Internally renames a bit of code to make it easy to identify between when we are disabling the buttons that open and close the modal editor (in Git Panel and Project Diff) vs when we are disabling the commit buttons (in Git Panel and Git commit editor modal). - Deletes some unused code. Release Notes: - Unified disabling / enabling the button to open the Git commit editor modal in the Git panel with the Project Diff commit button. - Unified disabling / enabling the commit buttons, for the same cases, between the Git panel and Git commit editor modal.
This commit is contained in:
@@ -6,10 +6,7 @@ use client::ProjectId;
|
||||
use futures::channel::{mpsc, oneshot};
|
||||
use futures::StreamExt as _;
|
||||
use git::repository::{Branch, CommitDetails, PushOptions, Remote, RemoteCommandOutput, ResetMode};
|
||||
use git::{
|
||||
repository::{GitRepository, RepoPath},
|
||||
status::{GitSummary, TrackedSummary},
|
||||
};
|
||||
use git::repository::{GitRepository, RepoPath};
|
||||
use gpui::{
|
||||
App, AppContext, AsyncApp, Context, Entity, EventEmitter, SharedString, Subscription, Task,
|
||||
WeakEntity,
|
||||
@@ -1073,18 +1070,6 @@ impl Repository {
|
||||
self.repository_entry.status_len()
|
||||
}
|
||||
|
||||
fn have_changes(&self) -> bool {
|
||||
self.repository_entry.status_summary() != GitSummary::UNCHANGED
|
||||
}
|
||||
|
||||
fn have_staged_changes(&self) -> bool {
|
||||
self.repository_entry.status_summary().index != TrackedSummary::UNCHANGED
|
||||
}
|
||||
|
||||
pub fn can_commit(&self, commit_all: bool) -> bool {
|
||||
return self.have_changes() && (commit_all || self.have_staged_changes());
|
||||
}
|
||||
|
||||
pub fn commit(
|
||||
&self,
|
||||
message: SharedString,
|
||||
|
||||
Reference in New Issue
Block a user