@@ -120,17 +120,32 @@ def blob_processor(package: ACBSPackageInfo, index: int, source_name: str) -> No
120
120
121
121
122
122
def git_fetch (info : ACBSSourceInfo , source_location : str , name : str ) -> Optional [ACBSSourceInfo ]:
123
+ try :
124
+ return gix_fetch (info , source_location , name )
125
+ except :
126
+ full_path = os .path .join (source_location , name )
127
+ if not os .path .exists (full_path ):
128
+ subprocess .check_call (['git' , 'clone' , '--bare' , info .url , full_path ])
129
+ else :
130
+ logging .info ('Updating repository...' )
131
+ subprocess .check_call (
132
+ ['git' , 'fetch' , 'origin' , '+refs/heads/*:refs/heads/*' , '--prune' ], cwd = full_path )
133
+ info .source_location = full_path
134
+ return info
135
+
136
+
137
+ def gix_fetch (info : ACBSSourceInfo , source_location : str , name : str ) -> Optional [ACBSSourceInfo ]:
123
138
full_path = os .path .join (source_location , name )
124
139
if not os .path .exists (full_path ):
125
- subprocess .check_call (['git ' , 'clone' , '--bare' , info .url , full_path ])
140
+ subprocess .check_call (['gix ' , 'clone' , '--bare' , info .url , full_path ])
126
141
else :
127
142
logging .info ('Updating repository...' )
143
+ # gix doesn't have the --prune option yet.
128
144
subprocess .check_call (
129
- ['git ' , 'fetch' , 'origin' , '+refs/heads/*:refs/heads/*' , '--prune ' ], cwd = full_path )
145
+ ['gix ' , 'fetch' , 'origin' , '+refs/heads/*:refs/heads/*' ], cwd = full_path )
130
146
info .source_location = full_path
131
147
return info
132
148
133
-
134
149
def git_processor (package : ACBSPackageInfo , index : int , source_name : str ) -> None :
135
150
info = package .source_uri [index ]
136
151
if not info .revision :
0 commit comments