summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index 1325d16..6f49cc8 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -481,7 +481,6 @@ async fn handle_commit_status(Path(path): Path<(String, String, String)>, State(
eprintln!("path: {}/{}, sha {}", path.0, path.1, path.2);
let remote_path = format!("{}/{}", path.0, path.1);
let sha = path.2;
- let short_sha = &sha[0..9];
let (commit_id, sha): (u64, String) = if sha.len() >= 7 {
match ctx.dbctx.conn.lock().unwrap()
@@ -497,6 +496,8 @@ async fn handle_commit_status(Path(path): Path<(String, String, String)>, State(
return (StatusCode::NOT_FOUND, Html("<html><body>no such commit</body></html>".to_string()));
};
+ let short_sha = &sha[0..9];
+
let (remote_id, repo_id): (u64, u64) = ctx.dbctx.conn.lock().unwrap()
.query_row("select id, repo_id from remotes where remote_path=?1;", [&remote_path], |row| Ok((row.get_unwrap(0), row.get_unwrap(1))))
.expect("can query");