scripts/git-cherry-gerrit.py |   22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

New commits:
commit 9f1a7480fb2479e75f75e6c7243d03951dcc32da
Author:     Jan Holesovsky <[email protected]>
AuthorDate: Mon Mar 2 11:47:02 2026 +0100
Commit:     Andras Timar <[email protected]>
CommitDate: Mon Mar 2 14:04:53 2026 +0100

    Warn about lines with spaces instead of tabs in the whitelist
    
    Change-Id: Ic0a9d22849a865158125eb78c4e351a94f376343
    Reviewed-on: https://gerrit.libreoffice.org/c/dev-tools/+/200824
    Reviewed-by: Andras Timar <[email protected]>
    Tested-by: Andras Timar <[email protected]>

diff --git a/scripts/git-cherry-gerrit.py b/scripts/git-cherry-gerrit.py
index e48d8f66..0c3c7fde 100755
--- a/scripts/git-cherry-gerrit.py
+++ b/scripts/git-cherry-gerrit.py
@@ -82,10 +82,29 @@ def main() -> None:
     # If there are no commits, we want an empty list, not a list with one 
empty item.
     if buffer:
         from_hashes = buffer.split("
")
+
     whitelist: List[str] = []
     if whitelist_file:
         with open(whitelist_file, "r") as stream:
-            whitelist = stream.read().strip().split("
")
+            # Read all lines (including comments) as raw strings
+            whitelist_text = stream.read().strip()
+            whitelist = whitelist_text.split("
") if whitelist_text else []
+
+        for idx, line in enumerate(whitelist, start=1):
+            stripped = line.strip()
+            if not stripped:
+                continue
+            if stripped.startswith("#"):
+                continue
+            # The whitelist entries are expected to contain tabs (hash         
 author          subject)
+            if "       " not in line:
+                print(
+                    "WARNING: whitelist line {} does not contain any tabs; it 
may not match the script's 'pretty' output:
"
+                    "  {}
"
+                    "  Hint: whitelist lines are expected to look like 
'<hash>\t<author>\t<subject>' (copied from script output)."
+                    .format(idx, repr(line))
+                )
+
     for from_hash in from_hashes:
         changeid = get_change_id(git_cat_file, from_hash)
         if hash_length:
@@ -93,6 +112,7 @@ def main() -> None:
             pretty = from_hash[:hash_length] + "       " + from_pipe(["git", 
"--no-pager", "log", "-1", "--format=format:%an%x09%s%x0a", from_hash])
         else:
             pretty = from_pipe(["git", "--no-pager", "log", "-1", 
"--format=format:%h%x09%an%x09%s%x0a", from_hash])
+
         if not changeid:
             if not whitelist_file or not [entry for entry in whitelist if 
pretty in entry]:
                 print("WARNING: commit '" + pretty + "' has no Change-Id, 
assuming it has to be cherry-picked.")

Reply via email to