1
0
Fork 0

superproject: Fix crash when _git_event_log is None

File "${AOSP_ROOT}/.repo/repo/subcmds/info.py", line 106, in Execute
  srev = sp.commit_id if sp and sp.commit_id else "None"
                                  ^^^^^^^^^^^^
File "${AOSP_ROOT}/.repo/repo/git_superproject.py", line 146, in commit_id
  self._LogWarning(
  ~~~~~~~~~~~~~~~~^
      "git rev-parse call failed, command: git {}, "
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ...<3 lines>...
      p.stderr,
      ^^^^^^^^^
  )
  ^
File "${AOSP_ROOT}/.repo/repo/git_superproject.py", line 207, in _LogWarning
  self._LogMessage(f"warning: {fmt}", *inputs)
  ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "${AOSP_ROOT}/.repo/repo/git_superproject.py", line 193, in _LogMessage
  self._git_event_log.ErrorEvent(message, fmt)
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

AttributeError: 'NoneType' object has no attribute 'ErrorEvent'

Test: repo info -o with and without superproject
Change-Id: I3267eccd09df3a7bc71f9461be807dedd8082cfb
This commit is contained in:
Alexander Koskovich 2025-06-16 23:15:34 -04:00
parent 85352825ff
commit 233145f080
No known key found for this signature in database
GPG key ID: 6366F33F166F4C7E

View file

@ -190,6 +190,7 @@ class Superproject:
message = f"{self._LogMessagePrefix()} {fmt.format(*inputs)}"
if self._print_messages:
print(message, file=sys.stderr)
if self._git_event_log:
self._git_event_log.ErrorEvent(message, fmt)
def _LogMessagePrefix(self):