Skip to content
Snippets Groups Projects
Commit 8e5bf2c9 authored by richardmaw-codethink's avatar richardmaw-codethink
Browse files

tests/sources/git.py: Handle old git not supporting --first-parent

If we don't have `--first-parent` then we won't get tag1.

Not having `--first-parent` is not treated as an error by the source plugin,
and instead results in a different cache key,
so this is assumed to be intended behaviour.
parent 719ade06
No related branches found
No related tags found
Loading
Pipeline #43446242 passed
......@@ -869,14 +869,17 @@ def test_git_describe(cli, tmpdir, datafiles, ref_storage, tag_type):
cwd=checkout).decode('ascii')
assert describe.startswith('tag2-2-')
describe_fp = subprocess.check_output(['git', 'describe', '--first-parent'] + options,
cwd=checkout).decode('ascii')
assert describe_fp.startswith('tag1-2-')
p = subprocess.run(['git', 'describe', '--first-parent'] + options,
cwd=checkout, stdout=subprocess.PIPE)
has_first_parent = p.returncode == 0
if has_first_parent:
describe_fp = p.stdout.decode('ascii')
assert describe_fp.startswith('tag1-2-')
tags = subprocess.check_output(['git', 'tag'],
cwd=checkout).decode('ascii')
tags = set(tags.splitlines())
assert tags == set(['tag1', 'tag2'])
assert tags == set(['tag1', 'tag2']) if has_first_parent else set(['tag2'])
p = subprocess.run(['git', 'log', repo.rev_parse('uselesstag')],
cwd=checkout)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment