Skip to content

Commit 925ad8e

Browse files
committed
fetch: no need to hack gix
Gitoxide release 0.29.0 fixed gitoxide fetch bare repo bug
1 parent 4529549 commit 925ad8e

File tree

1 file changed

+0
-23
lines changed

1 file changed

+0
-23
lines changed

acbs/fetch.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -143,36 +143,13 @@ def git_fetch(info, source_location, name):
143143
return info
144144

145145

146-
def gix_hack(path: str):
147-
# FIXME: reset HEAD to the first valid branch to fix gix can't second fetch src issue.
148-
subprocess.check_call(
149-
['git', 'symbolic-ref', 'HEAD', 'refs/heads/HEAD'], cwd=path)
150-
valid_branches = subprocess.check_output(
151-
['git', 'branch'], cwd=path, encoding='utf-8').splitlines()
152-
invalid: bool = True
153-
for word in valid_branches:
154-
word = word.strip()
155-
if len(word) > 0:
156-
branch: str = word
157-
invalid = False
158-
break
159-
if invalid:
160-
logging.warn(
161-
'No valid branches found. Falling back to traditional git.')
162-
raise ValueError('No valid branches found')
163-
subprocess.check_call(
164-
['git', 'symbolic-ref', 'HEAD', 'refs/heads/' + branch], cwd=path)
165-
os.remove(os.path.join(path, "index"))
166-
167-
168146
def gix_fetch(info: ACBSSourceInfo, source_location: str, name: str) -> Optional[ACBSSourceInfo]:
169147
full_path = os.path.join(source_location, name)
170148
if not os.path.exists(full_path):
171149
subprocess.check_call(['gix', 'clone', '--bare', info.url, full_path])
172150
else:
173151
logging.info('Updating repository with gix...')
174152
# gix doesn't have the --prune option yet.
175-
gix_hack(full_path)
176153
subprocess.check_call(
177154
['gix', 'fetch', 'origin', '+refs/heads/*:refs/heads/*'], cwd=full_path)
178155
info.source_location = full_path

0 commit comments

Comments
 (0)