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],
)?;
// Set up remote push with credentials callback
let mut callbacks = RemoteCallbacks::new();
callbacks.credentials(move |_url, username, _allowed_types| {
let user = username.unwrap_or("git");
let token = get_git_token();
Cred::userpass_plaintext(user, &token)
});
// // Set up remote push with credentials callback
// let mut callbacks = RemoteCallbacks::new();
// callbacks.credentials(move |_url, username, _allowed_types| {
// let user = username.unwrap_or("git");
// let token = get_git_token();
// Cred::userpass_plaintext(user, &token)
// });
// Push changes
let mut push_options = PushOptions::new();
push_options.remote_callbacks(callbacks);
let mut remote = repo.find_remote("origin")?;
remote.push(&["refs/heads/main"], Some(&mut push_options))?;
// // Push changes
// let mut push_options = PushOptions::new();
// push_options.remote_callbacks(callbacks);
// let mut remote = repo.find_remote("origin")?;
// remote.push(&["refs/heads/main"], Some(&mut push_options))?;
println!("Changes committed and pushed successfully.");
Ok(())

View File

@ -16,7 +16,7 @@ mod filesync;
mod git;
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 =
"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