Skip to content

Commit

Permalink
Hide git fatal error if not in a git dir (#97)
Browse files Browse the repository at this point in the history
* Hide git fatal error if not in a git dir

* Updated PR references in 1 changelogs.

skip-checks: true

* Fix style

---------

Co-authored-by: Alex Spencer <alex.spencer@helsing.ai>
Co-authored-by: GitHub Action <github-action@users.noreply.github.com>
  • Loading branch information
3 people committed Oct 16, 2023
1 parent a8fe7fd commit 42fb45f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .changelog/_unreleased.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[[entries]]
id = "c259ed87-48f7-4a7b-8e16-6f33bd8a7c67"
type = "improvement"
description = "Hide git fatal error"
author = "alex.spencer@helsing.ai"
pr = "https://github.com/NiklasRosenstein/slap/pull/97"
4 changes: 3 additions & 1 deletion src/slap/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,9 @@ def find_repository(directory: Path) -> Repository:
directory = directory.resolve()

try:
git_root = Path(sp.check_output(["git", "rev-parse", "--show-toplevel"], cwd=directory).decode().strip())
git_root = Path(
sp.check_output(["git", "rev-parse", "--show-toplevel"], cwd=directory, stderr=sp.STDOUT).decode().strip()
)
except sp.CalledProcessError:
git_root = None

Expand Down

0 comments on commit 42fb45f

Please sign in to comment.