[gitg] Avoid duplicating Signed-off-by signature



commit 0e79cd587e973614fbbb6fdd1ae297b1bb878478
Author: Alberto Fanjul <albertofanjul gmail com>
Date:   Wed Oct 16 00:53:36 2019 +0200

    Avoid duplicating Signed-off-by signature

 libgitg/gitg-stage.vala | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/libgitg/gitg-stage.vala b/libgitg/gitg-stage.vala
index 95f81233..0eb2f071 100644
--- a/libgitg/gitg-stage.vala
+++ b/libgitg/gitg-stage.vala
@@ -166,9 +166,12 @@ public class Stage : Object
        private string message_with_sign_off(string         message,
                                             Ggit.Signature committer)
        {
-               return "%s\nSigned-off-by: %s <%s>\n".printf(message,
-                                                            committer.get_name(),
-                                                            committer.get_email());
+               var signed_off = "Signed-off-by: %s <%s>".printf(committer.get_name(),
+                                                               committer.get_email());
+               if (!message.down().contains(signed_off.down())) {
+                       return "%s\n%s\n".printf(message, signed_off);
+               }
+               return message;
        }
 
        private string convert_message_to_encoding(Ggit.Config conf,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]