Compare commits

...

1 Commits

Author SHA1 Message Date
Robin Gottschalk
b4db53cb9b Changed paths to match dragonfly laptop and disable push temporarily 2025-02-17 23:17:34 +01:00
2 changed files with 13 additions and 13 deletions

View File

@ -66,19 +66,19 @@ pub fn backup_changes(repo_path: &Path) -> Result<(), Box<dyn std::error::Error>
&[&parent_commit], &[&parent_commit],
)?; )?;
// Set up remote push with credentials callback // // Set up remote push with credentials callback
let mut callbacks = RemoteCallbacks::new(); // let mut callbacks = RemoteCallbacks::new();
callbacks.credentials(move |_url, username, _allowed_types| { // callbacks.credentials(move |_url, username, _allowed_types| {
let user = username.unwrap_or("git"); // let user = username.unwrap_or("git");
let token = get_git_token(); // let token = get_git_token();
Cred::userpass_plaintext(user, &token) // Cred::userpass_plaintext(user, &token)
}); // });
// Push changes // // Push changes
let mut push_options = PushOptions::new(); // let mut push_options = PushOptions::new();
push_options.remote_callbacks(callbacks); // push_options.remote_callbacks(callbacks);
let mut remote = repo.find_remote("origin")?; // let mut remote = repo.find_remote("origin")?;
remote.push(&["refs/heads/main"], Some(&mut push_options))?; // remote.push(&["refs/heads/main"], Some(&mut push_options))?;
println!("Changes committed and pushed successfully."); println!("Changes committed and pushed successfully.");
Ok(()) Ok(())

View File

@ -16,7 +16,7 @@ mod filesync;
mod git; mod git;
const PROTECT_PREFIX: &str = ".git"; // only at first directory level const PROTECT_PREFIX: &str = ".git"; // only at first directory level
const SOURCE_VAULT: &str = "D:\\Cloud\\Syncthing\\obsidian-vault"; // syncthing vault folder const SOURCE_VAULT: &str = "C:\\Users\\robin\\Obsidian"; // syncthing vault folder
const REPO_VAULT: &str = const REPO_VAULT: &str =
"C:\\Users\\robin\\AppData\\Roaming\\obsidian-git-backup\\obsidian-vault-clone"; // git repo folder "C:\\Users\\robin\\AppData\\Roaming\\obsidian-git-backup\\obsidian-vault-clone"; // git repo folder
const GIT_COMMIT_DELAY_AFTER_FILE_CHANGE: Duration = Duration::from_secs(5 * 60); // 5 min const GIT_COMMIT_DELAY_AFTER_FILE_CHANGE: Duration = Duration::from_secs(5 * 60); // 5 min