diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2019-01-14 15:02:52 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2019-01-14 16:26:13 +0000 |
commit | 8e5bf2c92b33ee3e32354d6ec952db5bf2b0489d (patch) | |
tree | 12fa99911c71f25f6c5f15e7b1f9e7b1021f09c3 | |
parent | 719ade06cdcf5af43e95b0cc06b091b14bc9c1b3 (diff) | |
download | buildstream-richardmaw/oldgit-shallow-parents-exclude-fix.tar.gz |
tests/sources/git.py: Handle old git not supporting --first-parentrichardmaw/oldgit-shallow-parents-exclude-fix
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.
-rw-r--r-- | tests/sources/git.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/sources/git.py b/tests/sources/git.py index f9aa62ba4..bc7394852 100644 --- a/tests/sources/git.py +++ b/tests/sources/git.py @@ -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) |