git-mr-create: escape newline in all tags, not only in MR description
authorFrantisek Hrbata <frantisek@hrbata.com>
Thu, 3 Dec 2020 17:25:51 +0000 (18:25 +0100)
committerFrantisek Hrbata <frantisek@hrbata.com>
Thu, 3 Dec 2020 17:42:58 +0000 (18:42 +0100)
Signed-off-by: Frantisek Hrbata <frantisek@hrbata.com>
git-mr-create
mrlib.py

index 62034c245f42f58fb6d9123ee8793663ec793860..b29080ce448715c7147547d81ef0d2893fc12fdc 100755 (executable)
@@ -74,7 +74,6 @@ if not subj:
 desc = ""
 if len(split) > 1:
     desc = "".join(split[1:])
-    desc = desc.replace("\n", "\\n")
 
 an = mrlib.git_config("user.name")
 if not an:
index 88698741be8d20c3fbc54b9869da4aaa74127796..ddc96b39732ef1a07a277a66e27ae10c2663432c 100755 (executable)
--- a/mrlib.py
+++ b/mrlib.py
@@ -160,6 +160,7 @@ def add_tag(tags, mr, commit, tag, user, value):
     if tag not in tags[mr][commit]:
         tags[mr][commit][tag] = set()
 
+    value = str(value).replace("\n", "\\n")
     tags[mr][commit][tag].add((user, value))
 
 def remove_tag(tags, mr, commit, tag, user=None, value=None):
@@ -227,8 +228,6 @@ def load_tags(mrs, refs=None, users=None, commits=True, squash=False):
         if not commits and commit != rev_zero:
             continue
 
-        value = value.replace("\\n", "\n")
-
         add_tag(tags, mr, commit, tag, user, value)
 
         if tag == "at":