Skip to content

Commit f8213e5

Browse files
committed
✨ when the computer is offline, allow the process to continue without updating the repo
1 parent 00da96b commit f8213e5

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

gitfs2/opener.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def open_fs(self, fs_url, parse_result, writeable, create, cwd):
1818
submodule=parse_result.params.get("submodule"),
1919
reference=parse_result.params.get("reference"),
2020
)
21+
2122
local_folder = repo.git_clone(
2223
require, action_required=GitFSOpener.update_registry.get(git_url, True)
2324
)

gitfs2/repo.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22
import sys
33
import errno
44
import subprocess
5+
import logging
56

67
import fs
78
import fs.path
89
import fs.errors
910
from gitfs2 import reporter, constants
1011

12+
LOG = logging.getLogger(__name__)
13+
1114

1215
class GitRequire(object):
1316
def __init__(
@@ -49,6 +52,7 @@ def convert_submodule(submodule_string):
4952

5053
def git_clone(require, action_required=True):
5154
from git import Repo
55+
from git.exc import GitCommandError
5256

5357
if sys.platform != "win32":
5458
# Unfortunately for windows user, the following function
@@ -83,6 +87,10 @@ def git_clone(require, action_required=True):
8387
if require.submodule:
8488
reporter.info("checking out submodule")
8589
repo.git.submodule("update", "--init")
90+
except GitCommandError as e:
91+
reporter.warn("Unable to run git commands")
92+
LOG.warn(e)
93+
return local_repo_folder
8694

8795
return local_repo_folder
8896

0 commit comments

Comments
 (0)