[Notes] [Git][BuildStream/buildstream][richardmaw/oldgit-shallow-parents-exclude-fix] WIP: tests/sources/git.py: Handle old git not supporting --first-parent



Title: GitLab

richardmaw-codethink pushed to branch richardmaw/oldgit-shallow-parents-exclude-fix at BuildStream / buildstream

Commits:

1 changed file:

Changes:

  • tests/sources/git.py
    ... ... @@ -869,14 +869,17 @@ def test_git_describe(cli, tmpdir, datafiles, ref_storage, tag_type):
    869 869
                                            cwd=checkout).decode('ascii')
    
    870 870
         assert describe.startswith('tag2-2-')
    
    871 871
     
    
    872
    -    describe_fp = subprocess.check_output(['git', 'describe', '--first-parent'] + options,
    
    873
    -                                          cwd=checkout).decode('ascii')
    
    874
    -    assert describe_fp.startswith('tag1-2-')
    
    872
    +    exit_code, out = subprocess.check_output(['git', 'describe', '--first-parent'] + options,
    
    873
    +                                             cwd=checkout)
    
    874
    +    has_first_parent == exit_code == 0
    
    875
    +    if has_first_parent:
    
    876
    +        describe_fp = out.decode('ascii')
    
    877
    +        assert describe_fp.startswith('tag1-2-')
    
    875 878
     
    
    876 879
         tags = subprocess.check_output(['git', 'tag'],
    
    877 880
                                        cwd=checkout).decode('ascii')
    
    878 881
         tags = set(tags.splitlines())
    
    879
    -    assert tags == set(['tag1', 'tag2'])
    
    882
    +    assert tags == set(['tag1', 'tag2']) if has_first_parent else set(['tag2'])
    
    880 883
     
    
    881 884
         p = subprocess.run(['git', 'log', repo.rev_parse('uselesstag')],
    
    882 885
                            cwd=checkout)
    



  • [Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]