diff options
author | Martin Fischer <martin@push-f.com> | 2022-07-29 20:28:53 +0200 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2022-07-29 20:28:53 +0200 |
commit | d9cd7ab6f46ddc71206bb75bb72eb9dc36743cac (patch) | |
tree | 53fc33582ad451b51ab910db4bf70c8d6288e410 /src/controller.rs | |
parent | 4c036ec89cebabd4fcf068177cc668110c5a42ed (diff) |
refactor: introduce SoloController::new
Diffstat (limited to 'src/controller.rs')
-rw-r--r-- | src/controller.rs | 14 |
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 { |