@@ -6,6 +6,7 @@ use but_core::RefMetadata;
6
6
use gitbutler_command_context:: CommandContext ;
7
7
use gitbutler_error:: error:: Code ;
8
8
use gitbutler_oxidize:: OidExt ;
9
+ use gix:: reference:: Category ;
9
10
use gix:: remote:: Direction ;
10
11
use std:: collections:: HashSet ;
11
12
use std:: path:: Path ;
@@ -145,7 +146,8 @@ pub fn branch_details(
145
146
/// This branch is assumed to not be in the workspace, but it will still be assumed to want to integrate with the workspace target reference if set.
146
147
///
147
148
/// ### Implementation
148
- #[ allow( unused_variables) ]
149
+ ///
150
+ /// Note that not all possible [`PushStatus`] status are respected.
149
151
pub fn branch_details_v3 (
150
152
repo : & gix:: Repository ,
151
153
name : & gix:: refs:: FullNameRef ,
@@ -197,24 +199,26 @@ pub fn branch_details_v3(
197
199
) ?;
198
200
// TODO: have a test that shows why this must/should be last. Then maybe make it easy to do
199
201
// the right thing whenever the mergebase with the integration branch is needed.
200
- merge_bases. last ( ) . map ( |id| id. detach ( ) )
202
+ merge_bases
203
+ . last ( )
204
+ . map ( |id| id. detach ( ) )
205
+ . with_context ( || format ! ( "No merge-base found between {name} and the integration branch {integration_ref_name}" , name = name. as_bstr( ) ) ) ?
201
206
} ;
202
207
203
- todo ! ( )
204
- // Ok(ui::BranchDetails {
205
- // name: name.as_bstr().into(),
206
- // remote_tracking_branch: remote_tracking_branch.map(|b| b.name().as_bstr().to_owned()),
207
- // description: meta.description.clone(),
208
- // pr_number: meta.review.pull_request,
209
- // review_id: meta.review.review_id.clone(),
210
- // base_commit: todo!(),
211
- // push_status,
212
- // last_updated_at: todo!(),
213
- // authors: todo!(),
214
- // is_conflicted: todo!(),
215
- // commits: todo!(),
216
- // upstream_commits: todo!(),
217
- // tip: branch_target_id.detach(),
218
- // is_remote_head: name.category() == Some(Category::RemoteBranch),
219
- // })
208
+ Ok ( ui:: BranchDetails {
209
+ name : name. as_bstr ( ) . into ( ) ,
210
+ remote_tracking_branch : remote_tracking_branch. map ( |b| b. name ( ) . as_bstr ( ) . to_owned ( ) ) ,
211
+ description : meta. description . clone ( ) ,
212
+ pr_number : meta. review . pull_request ,
213
+ review_id : meta. review . review_id . clone ( ) ,
214
+ base_commit,
215
+ push_status,
216
+ last_updated_at : todo ! ( ) ,
217
+ authors : todo ! ( ) ,
218
+ is_conflicted : todo ! ( ) ,
219
+ commits : todo ! ( ) ,
220
+ upstream_commits : todo ! ( ) ,
221
+ tip : branch_target_id. detach ( ) ,
222
+ is_remote_head : name. category ( ) == Some ( Category :: RemoteBranch ) ,
223
+ } )
220
224
}
0 commit comments