git: Add askpass delegate to git-commit handlers (#42239)

In my local setup, I always enforce git-commit signing with GPG/SSH
which automatically enforces `git commit -S` when committing. This
changeset will now show a modal to the user for them to specify the
passphrase (if any) so that they can unlock their private key for
signing when committing in Zed.

<img width="1086" height="948" alt="Screenshot 2025-11-07 at 11 09
09 PM"
src="https://github.com/user-attachments/assets/ac34b427-c833-41c7-b634-8781493f8a5e"
/>


Release Notes:

- Handle automatic git-commit signing by presenting the user with an
askpass modal
This commit is contained in:
Jakub Konka
2025-11-10 07:57:50 +00:00
committed by GitHub
parent b8081ad7a6
commit 359160c8b1
5 changed files with 69 additions and 29 deletions
+3 -2
View File
@@ -1585,6 +1585,7 @@ impl GitPanel {
return;
}
let askpass = self.askpass_delegate("git commit", window, cx);
let commit_message = self.custom_or_suggested_commit_message(window, cx);
let Some(mut message) = commit_message else {
@@ -1599,7 +1600,7 @@ impl GitPanel {
let task = if self.has_staged_changes() {
// Repository serializes all git operations, so we can just send a commit immediately
let commit_task = active_repository.update(cx, |repo, cx| {
repo.commit(message.into(), None, options, cx)
repo.commit(message.into(), None, options, askpass, cx)
});
cx.background_spawn(async move { commit_task.await? })
} else {
@@ -1621,7 +1622,7 @@ impl GitPanel {
cx.spawn(async move |_, cx| {
stage_task.await?;
let commit_task = active_repository.update(cx, |repo, cx| {
repo.commit(message.into(), None, options, cx)
repo.commit(message.into(), None, options, askpass, cx)
})?;
commit_task.await?
})