aboutsummaryrefslogtreecommitdiff
path: root/src/controller.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/controller.rs')
-rw-r--r--src/controller.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/controller.rs b/src/controller.rs
index 55ff4c2..7a4a44a 100644
--- a/src/controller.rs
+++ b/src/controller.rs
@@ -75,6 +75,20 @@ pub trait Controller {
pub struct SoloController(pub Branch);
+impl SoloController {
+ pub fn new(repo: &Repository) -> Self {
+ Self(Branch(
+ repo.find_reference("HEAD")
+ .unwrap()
+ .symbolic_target()
+ .unwrap()
+ .strip_prefix("refs/heads/")
+ .unwrap()
+ .to_owned(),
+ ))
+ }
+}
+
const USERNAME_HEADER: &str = "Username";
impl Controller for SoloController {