Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions crates/collab/tests/integration/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7315,6 +7315,20 @@ async fn test_remote_git_branches(
});

assert_eq!(host_branch.name(), "totally-new-branch");

let default_branch_b = cx_b
.update(|cx| repo_b.update(cx, |repository, _cx| repository.default_branch(false)))
.await
.unwrap()
.unwrap();
assert_eq!(default_branch_b.as_deref(), Some("main"));

let default_branch_with_remote_b = cx_b
.update(|cx| repo_b.update(cx, |repository, _cx| repository.default_branch(true)))
.await
.unwrap()
.unwrap();
assert_eq!(default_branch_with_remote_b.as_deref(), Some("origin/main"));
}

#[gpui::test]
Expand Down
3 changes: 2 additions & 1 deletion crates/project/src/git_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3137,7 +3137,7 @@ impl GitStore {

let branch = repository_handle
.update(&mut cx, |repository_handle, _| {
repository_handle.default_branch(false)
repository_handle.default_branch(envelope.payload.include_remote_name)
})
.await??
.map(Into::into);
Expand Down Expand Up @@ -7809,6 +7809,7 @@ impl Repository {
.request(proto::GetDefaultBranch {
project_id: project_id.0,
repository_id: id.to_proto(),
include_remote_name,
})
.await?;

Expand Down
1 change: 1 addition & 0 deletions crates/proto/proto/git.proto
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ message BlameBufferResponse {
message GetDefaultBranch {
uint64 project_id = 1;
uint64 repository_id = 2;
bool include_remote_name = 3;
}

message GetDefaultBranchResponse {
Expand Down
14 changes: 14 additions & 0 deletions crates/remote_server/src/remote_editing_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2207,6 +2207,20 @@ async fn test_remote_git_branches(cx: &mut TestAppContext, server_cx: &mut TestA
});

assert_eq!(server_branch.name(), "totally-new-branch");

let default_branch = cx
.update(|cx| repository.update(cx, |repository, _cx| repository.default_branch(false)))
.await
.unwrap()
.unwrap();
assert_eq!(default_branch.as_deref(), Some("main"));

let default_branch_with_remote = cx
.update(|cx| repository.update(cx, |repository, _cx| repository.default_branch(true)))
.await
.unwrap()
.unwrap();
assert_eq!(default_branch_with_remote.as_deref(), Some("origin/main"));
}

#[gpui::test]
Expand Down
Loading