[Libreoffice-commits] .: git-hooks/commit-msg

Norbert Thiebaud nthiebaud at kemper.freedesktop.org
Thu May 3 01:30:34 PDT 2012


 git-hooks/commit-msg |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 298fbdc42af781cdd47d2cbedd945ec8c4a564bc
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Thu May 3 03:17:35 2012 -0500

    commit-hook: tweak add_ChangeId() to tolerate git-am -s behavior
    
    git-am -s add systematically an empty line before adding the
    signoff line, which interfere with gerrit's rule that
    the ChangeID must be in the last paragraph
    
    This patch address that be remoming an existing Change-Id from
    the commit message and re-insterting it at the 'proper' place
    
    Change-Id: I I742b17031c6e3da4f9d94dcb0579bce8c496d41d
    Signed-off-by: Norbert Thiebaud <nthiebaud at gmail.com>

diff --git a/git-hooks/commit-msg b/git-hooks/commit-msg
index f8df4e2..d784d65 100755
--- a/git-hooks/commit-msg
+++ b/git-hooks/commit-msg
@@ -100,12 +100,14 @@ add_ChangeId() {
                 return
         fi
 
-        if grep -i '^Change-Id:' "$MSG" >/dev/null
+        id=`grep -i '^Change-Id:' "$MSG" | sed -e "s/.*://"`
+        temp_msg=`grep -v -i '^Change-Id:' "$MSG"`
+        echo "$temp_msg" > "$MSG"
+
+        if  test -z "$id"
         then
-                return
+            id=`_gen_ChangeId`
         fi
-
-        id=`_gen_ChangeId`
         perl -e '
                 $MSG = shift;
                 $id = shift;


More information about the Libreoffice-commits mailing list