Skip to content

Instantly share code, notes, and snippets.

@davidhavard
Last active February 1, 2017 11:55
Show Gist options
  • Save davidhavard/cef9878ede56fd219c46c545e82ec809 to your computer and use it in GitHub Desktop.
Save davidhavard/cef9878ede56fd219c46c545e82ec809 to your computer and use it in GitHub Desktop.

Revisions

  1. davidhavard revised this gist Feb 1, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@
    #
    # INSTALL:
    #
    # sh -c "$(curl -fsSL https://gist.github.com/davidhavard/cef9878ede56fd219c46c545e82ec809/raw/f8620d4a2c6247fc64a96ee392e4608cc4363e07/gistfile1.txt)"
    # sh -c "$(curl -fsSL https://gist.github.com/davidhavard/cef9878ede56fd219c46c545e82ec809/raw/gistfile1.txt)"
    #


  2. davidhavard revised this gist Feb 1, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -21,7 +21,7 @@ find . -type d -name '.git' | while read PROJECT; do
    echo "Creating commit hook '$PATH'"

    echo "#!/bin/sh" > $PATH
    echo "test \"\" != \"\$(grep -E '[A-Z]{2,9}-[0-9]+' \"\$1\")\" || {" >> $PATH
    echo "test \"\" != \"\$(grep -E '[A-Z|0-9]{2,9}-[0-9]+' \"\$1\")\" || {" >> $PATH
    echo " echo -e >&2 \"\e[31mERROR: Looks like you forgot the issue number.\e[0m\"" >> $PATH
    echo " exit 1" >> $PATH
    echo "}" >> $PATH
  3. davidhavard revised this gist Dec 5, 2016. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,8 @@
    # commit message
    #
    # INSTALL:
    #
    #
    # sh -c "$(curl -fsSL https://gist.github.com/davidhavard/cef9878ede56fd219c46c545e82ec809/raw/f8620d4a2c6247fc64a96ee392e4608cc4363e07/gistfile1.txt)"
    #


  4. davidhavard created this gist Dec 5, 2016.
    30 changes: 30 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    #!/bin/bash

    #
    # Create commit hook for all git repos
    # to check for JIRA ticket number in
    # commit message
    #
    # INSTALL:
    #
    #


    #
    # Create hooks in all git repos
    #
    find . -type d -name '.git' | while read PROJECT; do

    PATH=$PROJECT/hooks/commit-msg

    echo "Creating commit hook '$PATH'"

    echo "#!/bin/sh" > $PATH
    echo "test \"\" != \"\$(grep -E '[A-Z]{2,9}-[0-9]+' \"\$1\")\" || {" >> $PATH
    echo " echo -e >&2 \"\e[31mERROR: Looks like you forgot the issue number.\e[0m\"" >> $PATH
    echo " exit 1" >> $PATH
    echo "}" >> $PATH

    /bin/chmod +x $PATH

    done