CRM-12109 - Call git-footnote in commit-msg hook
authorTim Otten <totten@civicrm.org>
Wed, 27 Mar 2013 06:30:17 +0000 (02:30 -0400)
committerTim Otten <totten@civicrm.org>
Wed, 27 Mar 2013 06:30:17 +0000 (02:30 -0400)
----------------------------------------
* CRM-12109: Automatically append JIRA links to Git tickets
  http://issues.civicrm.org/jira/browse/CRM-12109

tools/scripts/git/commit-msg

index 0017268479c306d11dfa8812758d521b68f52fe5..93d0df693424dd83457ff0d67eafb427398f3ffe 100755 (executable)
@@ -2,4 +2,18 @@
 
 # Note: This shell script should be designed and tested for cross-platform use
 
-# Reserved for future use
\ No newline at end of file
+set -e
+
+if [ "$GIT_CANONICAL_REPO_NAME" = "civicrm-core" ]; then
+  PACKAGES="$GIT_DIR/../packages"
+else
+  PACKAGES="$GIT_DIR/../../packages"
+fi
+
+if [ -f "$PACKAGES/git-footnote/bin/git-footnote" ]; then
+  FILE="$1"
+  TMPFILE="$1.jira"
+  cp -p "$FILE" "$TMPFILE"
+  $PACKAGES/git-footnote/bin/git-footnote CRM http://issues.civicrm.org/jira < "$TMPFILE" > "$FILE"
+  rm -f "$TMPFILE"
+fi