File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -459,8 +459,14 @@ class GraalCommand(GitCommand):
459
459
def _pre_init (self ):
460
460
"""Initialize repositories directory path"""
461
461
462
- git_path = self .parsed_args .git_path
463
- setattr (self .parsed_args , 'gitpath' , git_path )
462
+ if not self .parsed_args .git_path :
463
+ base_path = os .path .expanduser ('~/.graal/repositories/' )
464
+ processed_uri = self .parsed_args .uri .lstrip ('/' )
465
+ git_path = os .path .join (base_path , processed_uri ) + '-git'
466
+ else :
467
+ git_path = self .parsed_args .git_path
468
+
469
+ setattr (self .parsed_args , 'git_path' , git_path )
464
470
465
471
@staticmethod
466
472
def setup_cmd_parser (categories , exec_path = False ):
Original file line number Diff line number Diff line change @@ -616,9 +616,17 @@ def test_backend_class(self):
616
616
617
617
self .assertIs (GraalCommand .BACKEND , Graal )
618
618
619
- def test_gitpath_init (self ):
619
+ @unittest .mock .patch ('os.path.expanduser' )
620
+ def test_gitpath_init (self , mock_expanduser ):
620
621
"""Test gitpath initialization"""
621
622
623
+ mock_expanduser .return_value = os .path .join (self .tmp_path , 'testpath' )
624
+ args = ['http://example.com/' ]
625
+
626
+ cmd = MockedGraalCommand (* args )
627
+ self .assertEqual (cmd .parsed_args .git_path ,
628
+ os .path .join (self .tmp_path , 'testpath/http://example.com/' + '-git' ))
629
+
622
630
args = ['http://example.com/' ,
623
631
'--git-path' , '/tmp/gitpath' ]
624
632
You can’t perform that action at this time.
0 commit comments