Fix name
authorNeil Muller <drnlmuller@gmail.com>
Sat, 21 Mar 2020 18:45:57 +0000 (20:45 +0200)
committerNeil Muller <drnlmuller@gmail.com>
Sat, 21 Mar 2020 18:45:57 +0000 (20:45 +0200)
README.md [new file with mode: 0644]
READNE.md [deleted file]
slack

diff --git a/README.md b/README.md
new file mode 100644 (file)
index 0000000..feeed2f
--- /dev/null
+++ b/README.md
@@ -0,0 +1,25 @@
+CTPUG gitolite hooks
+====================
+
+This repository is to track the various git hooks used by the CTPUG git infrastructure.
+
+These hooks are not automatically installed / deployed - that requires manual intervention
+on the actual server.
+
+Hooks
+-----
+
+### irker
+
+This handles posting commit messages to IRC via irker.
+
+### slack
+
+This handles posting commit messages to Slack using the slack webhook interface
+
+Scripts
+------
+
+### check-deploy
+
+This can be run on the server to report any outdated hooks.
diff --git a/READNE.md b/READNE.md
deleted file mode 100644 (file)
index feeed2f..0000000
--- a/READNE.md
+++ /dev/null
@@ -1,25 +0,0 @@
-CTPUG gitolite hooks
-====================
-
-This repository is to track the various git hooks used by the CTPUG git infrastructure.
-
-These hooks are not automatically installed / deployed - that requires manual intervention
-on the actual server.
-
-Hooks
------
-
-### irker
-
-This handles posting commit messages to IRC via irker.
-
-### slack
-
-This handles posting commit messages to Slack using the slack webhook interface
-
-Scripts
-------
-
-### check-deploy
-
-This can be run on the server to report any outdated hooks.
diff --git a/slack b/slack
index e83153cdc9c4cd3dbab1a963f65c43630a63cc05..45187cfe5b92ecd069760d374cc161d4f227fadb 100644 (file)
--- a/slack
+++ b/slack
@@ -14,14 +14,7 @@ function help() {
   echo " git config hooks.slack.channel 'general'"
   echo " git config hooks.slack.show-only-last-commit 'true' #optional"
   echo " git config hooks.slack.username 'git' #optional"
-  echo " git config hooks.slack.icon-url 'http://imgur/icon.png' #optional"
-  echo " git config hooks.slack.icon-emoji ':twisted_rightwards_arrows:' #optional"
   echo " git config hooks.slack.repo-nice-name 'MyRepo' #optional"
-  echo " git config hooks.slack.repos-root '/path/to/repos' #optional"
-  echo " git config hooks.slack.changeset-url-pattern 'http://yourserver/%repo_path%/changeset/%rev_hash
-%' #optional"
-  echo " git config hooks.slack.compare-url-pattern 'http://yourserver/%repo_path%/changeset/%old_rev_ha
-sh%..%new_rev_hash%' #optional"
 }
 
 function notify_slack() {
@@ -164,30 +157,9 @@ function notify_slack() {
 
 
   if [[ "${change_type}" != "delete" && "${refname_type}" == "branch" ]]; then
-    changeseturlpattern=`git config --get hooks.slack.changeset-url-pattern`
-    compareurlpattern=`git config --get hooks.slack.compare-url-pattern`
     reporoot=`git config --get hooks.slack.repos-root`
 
     urlformat=
-    if [ -n "$changeseturlpattern" -a -n "$reporoot" ]; then
-      if [[ $PWD == ${reporoot}* ]]; then
-        repopath=$PWD
-        base=`basename $PWD`
-        if [ "$base" == ".git" ]; then
-          repopath=`dirname $repopath`
-        fi
-        idx=`echo $reporoot | wc -c | tr -d ' '`
-        repopath=`echo $repopath | cut -c$idx-`
-        urlformat=`echo $changeseturlpattern | sed "s|%repo_path%|$repopath|g" | sed "s/%rev_hash%/%H/g"`
-
-        if [ -n "$compareurlpattern" ]; then
-          comparelink=`echo $compareurlpattern | sed "s|%repo_path%|$repopath|g"  | sed "s|%old_rev_hash%|$oldrev|g" | sed "s|%new_rev_hash%|$newrev|g"`
-          header=`echo $header | sed -e "s|\([a-zA-Z0-9]\{1,\} new commit[s]\{0,1\}\)|\<$comparelink\|\\1\>|"`
-        fi
-      else
-        echo >&2 "$PWD is not in $reporoot. Not creating hyperlinks."
-      fi
-    fi
 
     formattedurl=""
     if [ -n "$urlformat" ]; then
@@ -235,8 +207,6 @@ function notify_slack() {
   webhook_url=$(git config --get hooks.slack.webhook-url)
   channel=$(git config --get hooks.slack.channel)
   username=$(git config --get hooks.slack.username)
-  iconurl=$(git config --get hooks.slack.icon-url)
-  iconemoji=$(git config --get hooks.slack.icon-emoji)
 
   if [ -z "$webhook_url" ] || [ -z "$channel" ]; then
     echo "ERROR: config settings not found"
@@ -250,12 +220,6 @@ function notify_slack() {
     payload="$payload, \"username\": \"$username\""
   fi
 
-  if [ -n "$iconurl" ]; then
-    payload="$payload, \"icon_url\": \"$iconurl\""
-  elif [ -n "$iconemoji" ]; then
-    payload="$payload, \"icon_emoji\": \"$iconemoji\""
-  fi
-
   payload="$payload}"
 
   if [ -n "$DEBUG" ]; then