From 97ca50f5f946c39e8ecd00c7e6ea78e90b4bb6dd Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Fri, 23 Feb 2024 19:18:57 -0800 Subject: [PATCH] git_command: Return None from GetEventTargetPath() if set to empty string If trace2.eventTarget was set to the empty string, match git behavior and don't write a trace. Bug: 319673783 Change-Id: I02b3884ad97551f8a9d7363c2cbe6b0adee6f73e Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/410518 Reviewed-by: Josip Sokcevic Commit-Queue: Josip Sokcevic Tested-by: Peter Collingbourne --- git_command.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/git_command.py b/git_command.py index 3c3869a2..09ed1a79 100644 --- a/git_command.py +++ b/git_command.py @@ -135,6 +135,8 @@ def GetEventTargetPath(): if retval == 0: # Strip trailing carriage-return in path. path = p.stdout.rstrip("\n") + if path == "": + return None elif retval != 1: # `git config --get` is documented to produce an exit status of `1` # if the requested variable is not present in the configuration.