monitoring-ecosystem-resilience icon indicating copy to clipboard operation
monitoring-ecosystem-resilience copied to clipboard

Function `get_tags()` fails when run from a clone without that git history present

Open andrewphilipsmith opened this issue 3 years ago • 0 comments

(Note: This issue was initially opened here https://github.com/urbangrammarai/gee_pipeline/issues/19)

How to reproduce

1). Make a shallow clone of the git repo:

$ mkdir gee_temp_clone
$ cd gee_temp_clone
$ git init .
$ git remote add origin https://github.com/urbangrammarai/gee_pipeline
$ git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin

2). Run a unit test which

$ pytest pyveg/tests/test_combiner_modules.py::test_combine

Expect behaviour

The function pyveg/src/file_utils.py::get_tags() should produce a meaningful version string, when operating without a full git clone.

Actual behaviour

The function pyveg/src/file_utils.py::get_tags(), calls the subprocess git describe --tags. This generates the error message (sterr): fatal: No names found, cannot describe anything.

The function pyveg/src/file_utils.py::get_tags() returns an empty string.

Note:

The scenario occurs when running testing in GitHub Actions, where shallow clones are the default.

andrewphilipsmith avatar Aug 31 '22 10:08 andrewphilipsmith