|
13 | 13 | # limitations under the License.
|
14 | 14 |
|
15 | 15 |
|
16 |
| -import argparse |
17 | 16 | import sys
|
| 17 | +import argparse |
18 | 18 |
|
19 | 19 | from fuse import FUSE
|
20 | 20 | from pygit2 import Keypair, UserPass
|
@@ -53,19 +53,24 @@ def prepare_components(args):
|
53 | 53 |
|
54 | 54 | credentials = get_credentials(args)
|
55 | 55 |
|
56 |
| - # setting router |
57 |
| - router = Router(remote_url=args.remote_url, |
58 |
| - mount_path=args.mount_point, |
59 |
| - repo_path=args.repo_path, |
60 |
| - branch=args.branch, |
61 |
| - user=args.user, |
62 |
| - group=args.group, |
63 |
| - max_size=args.max_size * 1024 * 1024, |
64 |
| - max_offset=args.max_size * 1024 * 1024, |
65 |
| - commit_queue=commit_queue, |
66 |
| - credentials=credentials, |
67 |
| - ignore_file=args.ignore_file, |
68 |
| - hard_ignore=args.hard_ignore) |
| 56 | + try: |
| 57 | + # setting router |
| 58 | + router = Router(remote_url=args.remote_url, |
| 59 | + mount_path=args.mount_point, |
| 60 | + repo_path=args.repo_path, |
| 61 | + branch=args.branch, |
| 62 | + user=args.user, |
| 63 | + group=args.group, |
| 64 | + max_size=args.max_size * 1024 * 1024, |
| 65 | + max_offset=args.max_size * 1024 * 1024, |
| 66 | + commit_queue=commit_queue, |
| 67 | + credentials=credentials, |
| 68 | + ignore_file=args.ignore_file, |
| 69 | + hard_ignore=args.hard_ignore) |
| 70 | + except KeyError as error: |
| 71 | + sys.stderr.write("Can't clone reference origin/%s from remote %s: %s\n" % |
| 72 | + (args.branch, args.remote_url, error)) |
| 73 | + raise error |
69 | 74 |
|
70 | 75 | # register all the routes
|
71 | 76 | router.register(routes)
|
@@ -101,7 +106,10 @@ def start_fuse():
|
101 | 106 | parser = argparse.ArgumentParser(prog='GitFS')
|
102 | 107 | args = parse_args(parser)
|
103 | 108 |
|
104 |
| - merge_worker, fetch_worker, router = prepare_components(args) |
| 109 | + try: |
| 110 | + merge_worker, fetch_worker, router = prepare_components(args) |
| 111 | + except: |
| 112 | + return |
105 | 113 |
|
106 | 114 | # ready to mount it
|
107 | 115 | if sys.platform == 'darwin':
|
|
0 commit comments