@@ -321,6 +321,14 @@ async fn get_commit_objects_to_sync(
321
321
} else {
322
322
// Remote branch does not exist. Find commits to push with reference to whatever
323
323
// remote branch head comes first in the local newbranch history, aka what it was branched off of.
324
+
325
+ // Early return to avoid checking for remote commits: if full local history and no remote branch,
326
+ // push full local branch history.
327
+ if api:: local:: commits:: commit_history_is_complete ( local_repo, local_commit) {
328
+ return api:: local:: commits:: list_from ( local_repo, & local_commit. id ) ;
329
+ }
330
+
331
+ // Otherwise, find the remote commit that the local branch was branched off of and push everything since then.
324
332
let all_commits = api:: remote:: commits:: list_all ( remote_repo) . await ?;
325
333
log:: debug!( "got all remote commits as {:#?}" , all_commits) ;
326
334
let maybe_remote_commit =
@@ -333,22 +341,6 @@ async fn get_commit_objects_to_sync(
333
341
& remote_commit,
334
342
local_commit,
335
343
) ?;
336
-
337
- println ! ( "🐂 Getting commit history..." ) ;
338
- let remote_history =
339
- api:: remote:: commits:: list_commit_history ( remote_repo, & branch. name )
340
- . await
341
- . unwrap_or_else ( |_| vec ! [ ] ) ;
342
- log:: debug!(
343
- "get_commit_objects_to_sync calculated {} commits" ,
344
- commits_to_sync. len( )
345
- ) ;
346
-
347
- commits_to_sync. retain ( |commit| {
348
- !remote_history
349
- . iter ( )
350
- . any ( |remote_commit| remote_commit. id == commit. id )
351
- } ) ;
352
344
} else {
353
345
commits_to_sync = api:: local:: commits:: list_from ( local_repo, & local_commit. id ) ?;
354
346
}
0 commit comments