biothings / biothings.api

BioThings API framework - Making high-performance API for biological annotation data
https://biothings.io
Apache License 2.0
45 stars 25 forks source link

`git rev-list` does not work with argument `main` #187

Closed erikyao closed 2 years ago

erikyao commented 2 years ago

The following errors were raised when I updated the multiomics_wellness_kp plugin and finished uploading under the pending.io studio.

Sep 13 22:55:47 su06 python[2223206]: DEBUG:hub:Remove PID file '/data/pending/run/2223206_wyqhdiDv.pickle'
Sep 13 22:55:48 su06 python[2221776]: INFO:upload_multiomics_wellness_kp:Renaming collection 'multiomics_wellness_kp_temp_VtZr9WKo' to 'multiomics_wellness_kp'
Sep 13 22:55:48 su06 python[2221776]: ERROR:root:Error while getting git information for file './plugins/multiomics_wellness_kp'
Sep 13 22:55:48 su06 python[2221776]: Traceback (most recent call last):
Sep 13 22:55:48 su06 python[2221776]:   File "/opt/home/pending/venv/src/biothings/biothings/utils/version.py", line 253, in get_source_code_info
Sep 13 22:55:48 su06 python[2221776]:     hash = gcmd.rev_list(-1, repo.active_branch, abs_src_file)
Sep 13 22:55:48 su06 python[2221776]:   File "/opt/home/pending/venv/lib/python3.8/site-packages/git/cmd.py", line 585, in <lambda>
Sep 13 22:55:48 su06 python[2221776]:     return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
Sep 13 22:55:48 su06 python[2221776]:   File "/opt/home/pending/venv/lib/python3.8/site-packages/git/cmd.py", line 1124, in _call_process
Sep 13 22:55:48 su06 python[2221776]:     return self.execute(call, **exec_kwargs)
Sep 13 22:55:48 su06 python[2221776]:   File "/opt/home/pending/venv/lib/python3.8/site-packages/git/cmd.py", line 928, in execute
Sep 13 22:55:48 su06 python[2221776]:     raise GitCommandError(redacted_command, status, stderr_value, stdout_value)
Sep 13 22:55:48 su06 python[2221776]: git.exc.GitCommandError: Cmd('git') failed due to: exit code(128)
Sep 13 22:55:48 su06 python[2221776]:   cmdline: git rev-list -1 main /opt/home/pending/pending.api/plugins/multiomics_wellness_kp
Sep 13 22:55:48 su06 python[2221776]:   stderr: 'fatal: ambiguous argument 'main': unknown revision or path not in the working tree.
Sep 13 22:55:48 su06 python[2221776]: Use '--' to separate paths from revisions, like this:
Sep 13 22:55:48 su06 python[2221776]: 'git <command> [<revision>...] -- [<file>...]''
Sep 13 22:55:48 su06 python[2221776]: DEBUG:hub:Remove PID file '/data/pending/run/ThreadPoolExecutor-0_0_FjBDX06H.pickle'
Sep 13 22:55:48 su06 python[2221776]: INFO:upload_multiomics_wellness_kp:success [steps=data,post,master,clean]
Sep 13 22:55:48 su06 python[2221776]: INFO:hub:success

It's clear that the errors are due to the fact that command git rev-list -1 <revision> cannot work with a branch name like main.

zcqian commented 2 years ago

Let me know if it has been fixed in commit https://github.com/biothings/biothings.api/commit/17d2a4242b75034ea110439328b35a2a20f0a5d2

zcqian commented 2 years ago

Fixed in https://github.com/biothings/biothings.api/commit/17d2a4242b75034ea110439328b35a2a20f0a5d2