mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2025-01-06 01:27:24 +03:00
code push ends with pushing all gb refs
This commit is contained in:
parent
7a787f53eb
commit
dc4fddf81f
@ -307,9 +307,8 @@ impl Repository {
|
||||
|
||||
pub fn push_to_gitbutler_server(
|
||||
&self,
|
||||
oid: &git::Oid,
|
||||
user: Option<&users::User>,
|
||||
ref_prefix: &str,
|
||||
ref_spec: &str,
|
||||
) -> Result<(), RemoteError> {
|
||||
let url = self
|
||||
.project
|
||||
@ -325,7 +324,6 @@ impl Repository {
|
||||
|
||||
tracing::debug!(
|
||||
project_id = %self.project.id,
|
||||
%oid,
|
||||
%url,
|
||||
"pushing code to gb repo",
|
||||
);
|
||||
@ -354,15 +352,13 @@ impl Repository {
|
||||
.remote_anonymous(&url)
|
||||
.map_err(|e| RemoteError::Other(e.into()))?;
|
||||
|
||||
let refspec = format!("+{}:refs/{}{}", oid, ref_prefix, self.project.id);
|
||||
|
||||
remote
|
||||
.push(&[refspec.as_str()], Some(&mut push_options))
|
||||
.push(&[ref_spec], Some(&mut push_options))
|
||||
.map_err(|e| RemoteError::Other(e.into()))?;
|
||||
|
||||
tracing::debug!(
|
||||
project_id = %self.project.id,
|
||||
%refspec,
|
||||
%ref_spec,
|
||||
bytes = bytes_pushed.load(std::sync::atomic::Ordering::Relaxed),
|
||||
"pushed to gb repo tmp ref",
|
||||
);
|
||||
|
@ -89,9 +89,13 @@ impl HandlerInner {
|
||||
"batches collected",
|
||||
);
|
||||
|
||||
let id_count = ids.len();
|
||||
|
||||
for (idx, id) in ids.iter().enumerate().rev() {
|
||||
let refspec = format!("+{}:refs/push-tmp/{}", id, project_id);
|
||||
|
||||
project_repository
|
||||
.push_to_gitbutler_server(id, user.as_ref(), "push-tmp/")
|
||||
.push_to_gitbutler_server(user.as_ref(), &refspec)
|
||||
.context("failed to push project to gitbutler")?;
|
||||
|
||||
self.project_store
|
||||
@ -104,14 +108,25 @@ impl HandlerInner {
|
||||
|
||||
tracing::debug!(
|
||||
%project_id,
|
||||
"project batch pushed: {}/{}",ids.len()-idx,ids.len(),
|
||||
"project batch pushed: {}/{}",id_count.saturating_sub(idx),id_count,
|
||||
);
|
||||
}
|
||||
|
||||
// push refs/{project_id}
|
||||
project_repository
|
||||
.push_to_gitbutler_server(&head_id, user.as_ref(), "")
|
||||
.push_to_gitbutler_server(
|
||||
user.as_ref(),
|
||||
&format!("+{}:refs/{}", head_id, project_id),
|
||||
)
|
||||
.context("failed to push project to gitbutler")?;
|
||||
|
||||
// push all gitbutler refs
|
||||
project_repository
|
||||
.push_to_gitbutler_server(user.as_ref(), "+refs/gitbutler/*:refs/gitbutler/*")
|
||||
.context("failed to push project to gitbutler")?;
|
||||
|
||||
//TODO: remove push-tmp ref
|
||||
|
||||
tracing::debug!(
|
||||
%project_id,
|
||||
"project fully pushed",
|
||||
|
Loading…
Reference in New Issue
Block a user