git: Only save dirty files during staging (#41047)
Closes #40581 Release Notes: - git: No longer save clean files when staging (to avoid triggering unnecessary rebuilds in external file watchers like vite)
This commit is contained in:
@@ -2008,7 +2008,7 @@ impl Buffer {
|
||||
self.end_transaction(cx)
|
||||
}
|
||||
|
||||
fn has_unsaved_edits(&self) -> bool {
|
||||
pub fn has_unsaved_edits(&self) -> bool {
|
||||
let (last_version, has_unsaved_edits) = self.has_unsaved_edits.take();
|
||||
|
||||
if last_version == self.version {
|
||||
|
||||
@@ -3618,6 +3618,7 @@ impl Repository {
|
||||
.read(cx)
|
||||
.file()
|
||||
.is_some_and(|file| file.disk_state().exists())
|
||||
&& buffer.read(cx).has_unsaved_edits()
|
||||
{
|
||||
save_futures.push(buffer_store.save_buffer(buffer, cx));
|
||||
}
|
||||
@@ -3684,6 +3685,7 @@ impl Repository {
|
||||
.read(cx)
|
||||
.file()
|
||||
.is_some_and(|file| file.disk_state().exists())
|
||||
&& buffer.read(cx).has_unsaved_edits()
|
||||
{
|
||||
save_futures.push(buffer_store.save_buffer(buffer, cx));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user