repo: improve duplicate default check

If one default is totally empty, we don't need to fail.

BUG=b:187795796
TEST=unit tests

Change-Id: Id226a7a7cd183dbdee58f4681b84885cc9211375
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/309102
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: Jack Neus <jackneus@google.com>
This commit is contained in:
Jack Neus 2021-06-15 14:28:30 +00:00
parent d58d0dd3bf
commit b8c84483a5

View File

@ -791,9 +791,10 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md
for node in itertools.chain(*node_list): for node in itertools.chain(*node_list):
if node.nodeName == 'default': if node.nodeName == 'default':
new_default = self._ParseDefault(node) new_default = self._ParseDefault(node)
emptyDefault = not node.hasAttributes() and not node.hasChildNodes()
if self._default is None: if self._default is None:
self._default = new_default self._default = new_default
elif new_default != self._default: elif not emptyDefault and new_default != self._default:
raise ManifestParseError('duplicate default in %s' % raise ManifestParseError('duplicate default in %s' %
(self.manifestFile)) (self.manifestFile))