Disable restore hunk control for created files (#25841)

Release Notes:

- Git Beta: disable hunk restore action and button for created files
This commit is contained in:
Cole Miller 2025-03-06 18:06:03 -05:00 committed by GitHub
parent efaf358876
commit a88af7351a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 17 additions and 1 deletions

View file

@ -154,6 +154,11 @@ impl MultiBufferDiffHunk {
secondary: self.secondary_status,
}
}
pub fn is_created_file(&self) -> bool {
self.diff_base_byte_range == (0..0)
&& self.buffer_range == (text::Anchor::MIN..text::Anchor::MAX)
}
}
#[derive(PartialEq, Eq, Ord, PartialOrd, Clone, Hash, Debug)]