diff options
author | Valentin David <valentin.david@codethink.co.uk> | 2019-01-15 14:01:53 +0100 |
---|---|---|
committer | Valentin David <valentin.david@codethink.co.uk> | 2019-01-16 11:04:57 +0100 |
commit | a405e08f7c3fb41a16dfd70fc1630069221aa453 (patch) | |
tree | 0b16dbd2584d57381be581ac6a72981dbfa5695a /buildstream/_gitsourcebase.py | |
parent | 0eac40085e5c8b8807002759f597f8e19a9745b2 (diff) | |
download | buildstream-a405e08f7c3fb41a16dfd70fc1630069221aa453.tar.gz |
buildstream/_gitsourcebase.py: Fix case where HEAD is tagged
`git rev-list --boundary HEAD..HEAD` does not return any boundary.
So in this case we need to manually tag the HEAD as a boundary.
Diffstat (limited to 'buildstream/_gitsourcebase.py')
-rw-r--r-- | buildstream/_gitsourcebase.py | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/buildstream/_gitsourcebase.py b/buildstream/_gitsourcebase.py index a71f70bdc..4ee870d99 100644 --- a/buildstream/_gitsourcebase.py +++ b/buildstream/_gitsourcebase.py @@ -296,19 +296,24 @@ class GitMirror(SourceFetcher): shallow = set() for _, commit_ref, _ in self.tags: - _, out = self.source.check_output([self.source.host_git, 'rev-list', - '--ancestry-path', '--boundary', - '{}..{}'.format(commit_ref, self.ref)], - fail="Failed to get git history {}..{} in directory: {}" - .format(commit_ref, self.ref, fullpath), - fail_temporarily=True, - cwd=self.mirror) - for line in out.splitlines(): - rev = line.lstrip('-') - if line[0] == '-': - shallow.add(rev) - else: - included.add(rev) + if commit_ref == self.ref: + # rev-list does not work in case of same rev + shallow.add(self.ref) + else: + _, out = self.source.check_output([self.source.host_git, 'rev-list', + '--ancestry-path', '--boundary', + '{}..{}'.format(commit_ref, self.ref)], + fail="Failed to get git history {}..{} in directory: {}" + .format(commit_ref, self.ref, fullpath), + fail_temporarily=True, + cwd=self.mirror) + self.source.warn("refs {}..{}: {}".format(commit_ref, self.ref, out.splitlines())) + for line in out.splitlines(): + rev = line.lstrip('-') + if line[0] == '-': + shallow.add(rev) + else: + included.add(rev) shallow -= included included |= shallow |