mrlib: don't call git-log in comments2mrs if there are no mboxes
authorFrantisek Hrbata <frantisek@hrbata.com>
Sun, 27 Dec 2020 12:21:18 +0000 (13:21 +0100)
committerFrantisek Hrbata <frantisek@hrbata.com>
Sun, 27 Dec 2020 12:21:18 +0000 (13:21 +0100)
If there are not mboxes git log --stdin gets stuck waiting on input.
In such case return empty dict.

Signed-off-by: Frantisek Hrbata <frantisek@hrbata.com>
mrlib.py

index cf2a2fb0c50e67545d437e53952e1f0406da1729..a1ed1983727fe61e8e89145cacd36802cd954f55 100755 (executable)
--- a/mrlib.py
+++ b/mrlib.py
@@ -177,13 +177,16 @@ def verify_commits(mrcommits, commits):
     return list(revs)
 
 def comments2mrs(refs, mrs=None):
+    m = dict()
+
     mb_refs = filter_refs(refs, mrs=mrs, types=["mbox"])
+    if not mb_refs:
+        return m
 
     stdin = "\n".join(ref for rev, ref in mb_refs)
     rv, out, err = run(["git", "log", "--format=%S %H", "--stdin"],
             stdin=stdin)
 
-    m = dict()
     for line in out.strip().split("\n"):
         ref, rev = line.split()
         mr = ref.split('/')[2]