GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — clibrowser/cligit/src/git_ctx.rs at main · allthingssecurity/clibrowser Expand file tree/ Copy pathgit_ctx.rsMore file actions 23 lines (21 loc) · 657 Bytes / Copy pathgit_ctx.rsFile metadata and controls23 lines (21 loc) · 657 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 use std::path::PathBuf; use git2::Repository; use crate::error::GitError; pub struct GitContext { pub repo: Repository, pub workdir: PathBuf, } impl GitContext { pub fn open(path: Option<&str>) -> Result<Self, GitError> { let start = match path { Some(p) => PathBuf::from(p), None => std::env::current_dir().map_err(|e| GitError::Io(e.to_string()))?, }; let repo = Repository::discover(&start).map_err(|_| GitError::NotARepo)?; let workdir = repo .workdir() .ok_or(GitError::BareRepo)? .to_path_buf(); Ok(GitContext { repo, workdir }) } } |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |