Skip to content

Commit

Permalink
fix(repo_sync): any ops can sync
Browse files Browse the repository at this point in the history
  • Loading branch information
lazhenyi committed Dec 31, 2024
1 parent cd18da1 commit 990ecf7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
5 changes: 2 additions & 3 deletions src/api/app_router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::api::handlers::repos::repos::{repo_create, repo_info, repo_search};
use crate::api::handlers::repos::star::{
repo_star_add, repo_star_count, repo_star_list, repo_star_remove,
};
use crate::api::handlers::repos::tree::repo_tree;
use crate::api::handlers::repos::tree::{repo_tree, repo_tree_sha};
use crate::api::handlers::repos::watch::{
repo_watch_add, repo_watch_count, repo_watch_list, repo_watch_remove,
};
Expand Down Expand Up @@ -108,9 +108,8 @@ pub fn AppRouter(cfg: &mut web::ServiceConfig) {
scope("/{branch}")
.route("", get().to(repo_branch_info))
.route("", delete().to(repo_branch_delete))
.route("", delete().to(repo_branch_delete))
.route("/tree", get().to(repo_tree))
.route("/tree/{sha}", get().to(repo_tree))
.route("/tree/{sha}", get().to(repo_tree_sha))
.route("/blob", get().to(repo_blob_sha))
.route(
"/protect",
Expand Down
1 change: 1 addition & 0 deletions src/git/http/backend/git_upload_pack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,6 @@ pub async fn git_upload_pack(
}
}
});
service._sync_repo(repo_id.uid).await.ok();
resp.body(body_stream)
}
1 change: 1 addition & 0 deletions src/git/http/backend/info_refs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ pub async fn info_refs(
}
_ => {}
}
service._sync_repo(repo_id.uid).await.ok();
body.push_str(&String::from_utf8(output.stdout).unwrap());
resp.body(body.as_bytes().to_vec())
}
10 changes: 5 additions & 5 deletions src/server/repos/branchs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ impl MetaData {
}
}
let _ = branchs::ActiveModel {
uid: sea_orm::ActiveValue::Set(Uuid::new_v4()),
repo_id: sea_orm::ActiveValue::Set(repo_id),
name: sea_orm::ActiveValue::Set(branch.name),
head: sea_orm::ActiveValue::Set(Option::from(branch.head)),
protect: sea_orm::ActiveValue::Set(false),
uid: ActiveValue::Set(Uuid::new_v4()),
repo_id: ActiveValue::Set(repo_id),
name: ActiveValue::Set(branch.name),
head: ActiveValue::Set(Option::from(branch.head)),
protect: ActiveValue::Set(false),
}
.insert(&txn)
.await;
Expand Down

0 comments on commit 990ecf7

Please sign in to comment.