[Notes] [Git][BuildStream/buildstream][richardmaw/oldgit-shallow-parents-exclude-fix] _gitsourcebase.py: Don't treat tags whose parents are included as shallow



Title: GitLab

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

Commits:

1 changed file:

Changes:

  • buildstream/_gitsourcebase.py
    ... ... @@ -312,6 +312,19 @@ class GitMirror(SourceFetcher):
    312 312
                 shallow -= included
    
    313 313
                 included |= shallow
    
    314 314
     
    
    315
    +            # Don't treat tags as shallow if all their parents are included
    
    316
    +            _, out = self.source.check_output([self.source.host_git, 'show', '--quiet',
    
    317
    +                                               '--format=tformat:%H %P'] + list(shallow),
    
    318
    +                                              fail="Failed to get parents of shallow commits in directory: {}"
    
    319
    +                                              .format(fullpath),
    
    320
    +                                              fail_temporarily=True,
    
    321
    +                                              cwd=self.mirror)
    
    322
    +            for line in out.splitlines():
    
    323
    +                commit, line = line.split(" ", 1)
    
    324
    +                parents = line.split(" ")
    
    325
    +                if included.issuperset(parents):
    
    326
    +                    shallow.discard(commit)
    
    327
    +
    
    315 328
                 self.source.call([self.source.host_git, 'init'],
    
    316 329
                                  fail="Cannot initialize git repository: {}".format(fullpath),
    
    317 330
                                  cwd=fullpath)
    



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