From df55f335f9a29947927e46f85962cdef0d27ca27 Mon Sep 17 00:00:00 2001 From: stormdragon2976 Date: Sun, 5 Feb 2023 14:18:41 -0500 Subject: [PATCH] First commit, added pre-push hook for posting commit message to Pleroma or Mastodon. --- LICENSE | 14 ++++++++++++++ pre-push | 22 ++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 LICENSE create mode 100755 pre-push diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ee7d6a5 --- /dev/null +++ b/LICENSE @@ -0,0 +1,14 @@ + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + + Copyright (C) 2004 Sam Hocevar + + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT THE FUCK YOU WANT TO. + diff --git a/pre-push b/pre-push new file mode 100755 index 0000000..e22a6d3 --- /dev/null +++ b/pre-push @@ -0,0 +1,22 @@ +#!/bin/bash + +# Requires toot: https://github.com/ihabunek/toot +# remote is $1 e.g. origin +# url is $2 +url="${2#*@}" +url="${url%.git}" +shopt -s extglob +url="${url/:*([0-9])//}" +url="https://${url//\/\///}" +branch="$(git branch | grep "\* ")" +branch="${branch:2}" +commit="$(git log -1 --pretty=%B)" +project="${2##*/}" +project="${project%.git}" +pusher="$(git log | grep -m1 "Author: ")" +pusher="${pusher#Author: }" +pusher="${pusher% <*@*.*>}" + +toot post --quiet -v public -p "$project" -t "text/markdown" "$pusher pushed changes to the $branch branch of the [$project project]($url) +$commit" +exit 0