git: Implement commit creation (#23263)

- [x] Basic implementation
- [x] Disable commit buttons when committing is not possible (empty
message, no changes)
- [x] Upgrade GitSummary to efficiently figure out whether there are any
staged changes
- [x] Make CommitAll work
- [x] Surface errors with toasts
  - [x] Channel shutdown
  - [x] Empty commit message or no changes
  - [x] Failed git operations
- [x] Fix added files no longer appearing correctly in the project panel
(GitSummary breakage)
- [x] Fix handling of commit message

Release Notes:

- N/A

---------

Co-authored-by: Nate <nate@zed.dev>
This commit is contained in:
Cole Miller 2025-01-17 13:51:20 -05:00 committed by GitHub
parent 3767e7e5f0
commit 5da67899b7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 387 additions and 198 deletions

View file

@ -1560,13 +1560,14 @@ pub fn entry_diagnostic_aware_icon_decoration_and_color(
}
pub fn entry_git_aware_label_color(git_status: GitSummary, ignored: bool, selected: bool) -> Color {
let tracked = git_status.index + git_status.worktree;
if ignored {
Color::Ignored
} else if git_status.conflict > 0 {
Color::Conflict
} else if git_status.modified > 0 {
} else if tracked.modified > 0 {
Color::Modified
} else if git_status.added > 0 || git_status.untracked > 0 {
} else if tracked.added > 0 || git_status.untracked > 0 {
Color::Created
} else {
entry_label_color(selected)