File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -219,6 +219,26 @@ async fn main() -> Result<()> {
219
219
}
220
220
}
221
221
222
+ fn get_or_init_project (
223
+ current_dir : & std:: path:: Path ,
224
+ ) -> anyhow:: Result < gitbutler_project:: Project > {
225
+ let repo = gix:: discover ( current_dir) ?;
226
+ if let Some ( path) = repo. workdir ( ) {
227
+ let project = match gitbutler_project:: Project :: find_by_path ( path) {
228
+ Ok ( p) => Ok ( p) ,
229
+ Err ( _e) => {
230
+ crate :: init:: repo ( path, false , false ) ?;
231
+ gitbutler_project:: Project :: find_by_path ( path)
232
+ }
233
+ } ?;
234
+ Ok ( project)
235
+ } else {
236
+ let error_desc = "Bare repositories are not supported." ;
237
+ println ! ( "{error_desc}" ) ;
238
+ anyhow:: bail!( error_desc) ;
239
+ }
240
+ }
241
+
222
242
pub ( crate ) fn props < E , T , R > ( start : std:: time:: Instant , result : R ) -> Props
223
243
where
224
244
R : std:: ops:: Deref < Target = Result < T , E > > ,
You can’t perform that action at this time.
0 commit comments