Skip to content

Commit

Permalink
fix: check if folder exists in is_initialized()
Browse files Browse the repository at this point in the history
  • Loading branch information
kaspar030 committed Feb 5, 2024
1 parent 0addf29 commit 41b8d9e
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,16 @@ impl GitRepo {
}

fn is_initialized(&self) -> Result<bool> {
Ok(matches!(
self.git()
.arg("rev-parse")
.arg("--git-dir")
.output()?
.stdout
.as_slice(),
b".\n" | b".git\n"
))
Ok(self.path.is_dir()
&& matches!(
self.git()
.arg("rev-parse")
.arg("--git-dir")
.output()?
.stdout
.as_slice(),
b".\n" | b".git\n"
))
}

fn has_commit(&self, commit: &str) -> Result<bool> {
Expand Down

0 comments on commit 41b8d9e

Please sign in to comment.