diff --git a/git_trace2_event_log.py b/git_trace2_event_log.py index 0d4f23f4..0e5e9089 100644 --- a/git_trace2_event_log.py +++ b/git_trace2_event_log.py @@ -167,9 +167,9 @@ class EventLog(object): repo_config = {k: v for k, v in config.items() if k.startswith('repo.')} self.LogConfigEvents(repo_config, 'def_param') - def GetDataEventName(self, key): - """Returns the 'data-json' if the key is argv else returns 'data'.""" - return 'data-json' if key.endswith('sys.argv') else 'data' + def GetDataEventName(self, value): + """Returns 'data-json' if the value is an array else returns 'data'.""" + return 'data-json' if value[0] == '[' and value[-1] == ']' else 'data' def LogDataConfigEvents(self, config, prefix): """Append a 'data' event for each config key/value in |config| to the current log. @@ -182,7 +182,7 @@ class EventLog(object): prefix: Prefix for each key that is logged. """ for key, value in config.items(): - event = self._CreateEventDict(self.GetDataEventName(key)) + event = self._CreateEventDict(self.GetDataEventName(value)) event['key'] = f'{prefix}/{key}' event['value'] = value self._log.append(event) diff --git a/tests/test_git_trace2_event_log.py b/tests/test_git_trace2_event_log.py index 6131c7b3..7bd21e21 100644 --- a/tests/test_git_trace2_event_log.py +++ b/tests/test_git_trace2_event_log.py @@ -267,7 +267,7 @@ class EventLogTestCase(unittest.TestCase): self.assertIn('value', event) key = event['key'].removeprefix(f'{prefix_value}/') value = event['value'] - self.assertEqual(self._event_log_module.GetDataEventName(key), event['event']) + self.assertEqual(self._event_log_module.GetDataEventName(value), event['event']) self.assertTrue(key in config and value == config[key]) def test_error_event(self):