git: Fix create remote branch (#44805)

Fix a bug where the branch picker would be dismissed before completing
the add remote flow, thus making Zed unable to add remote repositories
through the branch picker.

This bug was caused by the picker always being dismissed on the confirm
action, so the fix was stopping the branch modal from being dismissed
too early.

I also cleaned up the UI a bit and code.

1. Removed the loading field from the Branch delegate because it was
never used and the activity indicator will show remote add command if it
takes a while.
2. I replaced some async task spawning with the use of `cx.defer`.
3. Added a `add remote name` fake entry when the picker is in the name
remote state. I did this so the UI would be consistent with the other
states.
4. Added two regression tests. 
4.1 One to prevent this bug from occurring again:
https://github.com/zed-industries/zed/pull/44742
4.2 Another to prevent the early dismissal bug from occurring 
5. Made `init_branch_list_test` param order consistent with Zed's code
base

###### Updated UI
<img width="1150" height="298" alt="image"
src="https://github.com/user-attachments/assets/edead508-381c-4bd8-8a41-394dd5b7b781"
/>


Release Notes:

- N/A
This commit is contained in:
Anthony Eid
2025-12-14 07:55:19 -05:00
committed by GitHub
parent 6cc947f654
commit 00169e0ae2
3 changed files with 232 additions and 149 deletions

1
Cargo.lock generated
View File

@@ -7045,6 +7045,7 @@ dependencies = [
"picker",
"pretty_assertions",
"project",
"rand 0.9.2",
"recent_projects",
"remote",
"schemars",