richardmaw-codethink pushed to branch richardmaw/oldgit-shallow-parents-exclude-fix at BuildStream / buildstream
Commits:
-
719ade06
by Richard Maw at 2019-01-14T14:55:10Z
1 changed file:
Changes:
... | ... | @@ -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)
|