diff options
Diffstat (limited to 'src/login.rs')
| -rw-r--r-- | src/login.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/login.rs b/src/login.rs index ca12c50..8639d35 100644 --- a/src/login.rs +++ b/src/login.rs @@ -1,5 +1,6 @@ use std::path::{Path, PathBuf}; +use crate::config::RepoConfig; use crate::Login; use clap::Args; @@ -72,6 +73,22 @@ impl RepoId { fn repo_path(&self) -> PathBuf { return Path::join(crate::config::repo_store(), self.0.clone()); } + + fn get_config(&self) -> RepoConfig { + let config_process = std::process::Command::new("git") + .args([ + "-C", + self.repo_path().to_str().unwrap(), + "show", + "HEAD:.fagit.toml", + ]) + .output() + .unwrap(); + if !config_process.status.success() { + return RepoConfig::default(); + } + toml::de::from_str(&String::from_utf8(config_process.stdout).unwrap()).unwrap() + } } fn canonicalize_repo(path: &str, user: &UserToken) -> RepoId { |
