Pre Commit Hook

ahmerkhan
ahmerkhan
Hello All,   I need to create a Pre Comit Script with the following Parameters.   A typical comment must look like: KO/MB - CPLN555 - Add test case for xyz Ticket number is between the dashes. Allow "- NOSTORY -" to indicate that the changes do not need a corresponding story.  I am fairly a newbie to scripting, Is there anyone that can help ?   Thanks 

Last updated

ahmerkhan
ahmerkhan
This is what I came up with The regex works and was tested, what am i doing wrong with this pre-commit.  #!/bin/sh   REPOS="$1"   TXN="$2"   SVNLOOK=/usr/bin/svnlook   regex=“-\s*(?i)(\S+\d+|NOSTORY)\s*-"   if "$SVNLOOK" log -t "$TXN" "$REPOS" | head -n1 | grep -q '-\s*(?i)(\S+\d+|NOSTORY)\s*-' ; then    exit 0   else   echo "" 1>&2   echo "Please make your commit comment start with PRODUCT-XXX" 1>&2   exit 1   fi 

1-2 of 2

Reply to this discussion

You cannot edit posts or make replies: You should be logged in before you can post.