Skip to content

Commit 790cd3c

Browse files
committed
fetch: select a valid branch to workaround a gix bug
1 parent d83c9a7 commit 790cd3c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

acbs/fetch.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,10 @@ def gix_fetch(info: ACBSSourceInfo, source_location: str, name: str) -> Optional
143143
else:
144144
logging.info('Updating repository with gix...')
145145
# gix doesn't have the --prune option yet.
146-
# FIXME: reset HEAD to master to fix gix can't second fetch src issue.
147-
subprocess.check_call(['git', 'symbolic-ref', 'HEAD'], cwd=full_path)
146+
# FIXME: reset HEAD to the first valid branch to fix gix can't second fetch src issue.
147+
subprocess.check_call(['git', 'symbolic-ref', 'HEAD', 'refs/heads/HEAD'], cwd=full_path)
148+
valid_branches = subprocess.check_output(['git', 'branch'], cwd=full_path)
149+
subprocess.check_call(['git', 'symbolic-ref', 'HEAD', 'refs/heads/' + valid_branches.splitlines[0]], cwd=full_path)
148150
os.remove(os.path.join(full_path, "index"))
149151
subprocess.check_call(
150152
['gix', 'fetch', 'origin', '+refs/heads/*:refs/heads/*'], cwd=full_path)

0 commit comments

Comments
 (0)