From 1cc17151cd42cd4073c4ed59a9888baddb1492fd Mon Sep 17 00:00:00 2001 From: Neil Muller Date: Sat, 21 Mar 2020 20:45:57 +0200 Subject: [PATCH] Fix name --- READNE.md => README.md | 0 slack | 36 ------------------------------------ 2 files changed, 36 deletions(-) rename READNE.md => README.md (100%) diff --git a/READNE.md b/README.md similarity index 100% rename from READNE.md rename to README.md diff --git a/slack b/slack index e83153c..45187cf 100644 --- 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 -- 2.34.1