From 5b3669e24a8ce7f3f482de86fcf95620db643467 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 12 Aug 2021 07:30:49 +0800 Subject: Don't fail on import if the working dir isn't valid (#1319) --- git/cmd.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'git/cmd.py') diff --git a/git/cmd.py b/git/cmd.py index b84c43df..226b8710 100644 --- a/git/cmd.py +++ b/git/cmd.py @@ -781,7 +781,10 @@ class Git(LazyMixin): log.info(' '.join(redacted_command)) # Allow the user to have the command executed in their working dir. - cwd = self._working_dir or os.getcwd() + try: + cwd = self._working_dir or os.getcwd() # type: Union[None, str] + except FileNotFoundError: + cwd = None # Start the process inline_env = env -- cgit v1.2.1