@@ -2,7 +2,7 @@ use super::helpers::capture_err;
22use crate :: state:: { build_state, evolve_state} ;
33use crate :: storage:: store;
44use crate :: { db, git, shared_types} ;
5- use tauri:: AppHandle ;
5+ use tauri:: { AppHandle , State } ;
66
77/// Returns original (HEAD) and modified (working-tree) content for each requested file.
88#[ tauri:: command]
@@ -42,6 +42,7 @@ pub async fn git_status_and_cache(app: AppHandle) -> Result<shared_types::GitSta
4242#[ tauri:: command]
4343pub async fn git_commit (
4444 app : AppHandle ,
45+ db_pool : State < ' _ , db:: DbPool > ,
4546 message : String ,
4647) -> Result < shared_types:: CommitResult , String > {
4748 let dir = store:: ensure_git_repo_folder ( & app) . map_err ( |e| capture_err ( "git_commit" , e) ) ?;
@@ -56,22 +57,20 @@ pub async fn git_commit(
5657 log:: warn!( "[git_commit] Failed to tag commit: {}" , e) ;
5758 }
5859
59- if let Ok ( db_path) = db:: get_db_path ( & app) {
60- let now = crate :: utils:: unix_now ( ) ;
61- match db:: commits:: upsert_commit (
62- & db_path,
63- & commit_info. hash ,
64- & commit_info. tree_hash ,
65- Some ( & message) ,
66- now,
67- ) {
68- Ok ( id) => log:: info!(
69- "[git_commit] Saved commit to database (id={}, hash={})" ,
70- id,
71- & commit_info. hash[ ..8 ]
72- ) ,
73- Err ( e) => log:: error!( "[git_commit] Failed to save commit: {}" , e) ,
74- }
60+ let now = crate :: utils:: unix_now ( ) ;
61+ match db:: commits:: upsert_commit_in_pool (
62+ & db_pool,
63+ & commit_info. hash ,
64+ & commit_info. tree_hash ,
65+ Some ( & message) ,
66+ now,
67+ ) {
68+ Ok ( id) => log:: info!(
69+ "[git_commit] Saved commit to database (id={}, hash={})" ,
70+ id,
71+ & commit_info. hash[ ..8 ]
72+ ) ,
73+ Err ( e) => log:: error!( "[git_commit] Failed to save commit: {}" , e) ,
7574 }
7675
7776 // Update build state: new HEAD hash, no changeset (working tree is now clean).
0 commit comments