From 47b7016ed5ac6dd8efc041060d62e632e937a6d2 Mon Sep 17 00:00:00 2001 From: Carlos Maiolino Date: Sun, 21 Apr 2024 13:52:26 +0200 Subject: Initial commit --- stale/hooks.sh | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 stale/hooks.sh (limited to 'stale/hooks.sh') diff --git a/stale/hooks.sh b/stale/hooks.sh new file mode 100644 index 0000000..d8add42 --- /dev/null +++ b/stale/hooks.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +email=$1 +patch=/tmp/$$.patch +tempfile=/tmp/item_menu.$$ +sources=~/pristine/ + + + +clear_repo(){ + dialog --clear --yesno \ + " Wanna reset the git tree?" 0 0 + + if [ $? -eq 0 ]; then + git reset --hard + fi +} + +diff_patch(){ + + dialog --clear --yesno --yes-label "git diff" --no-label "difftool" \ + "Choose DIFF format:" 0 0 + + if [ $? -eq 0 ]; then + git diff + else + git difftool + fi + +} + +apply_patch(){ + repolist=$(ls $sources | awk '{print $1,$1}') + + dialog --clear --menu "Select repository to apply the patch" 0 0 20 $repolist 2> $tempfile + #"Select repository to apply the patch" 30 60 20 $repolist 2> $tempfile + + repo=`cat $tempfile` + + echo $repo + cd $sources/$repo + git apply $patch + #diff_patch + clear_repo +} + +clear_env(){ + rm -rf $tempfile + rm -rf $patch +} + +###main + +cat $email | formail -I "" > $patch +#cat $email | formail -I "" | awk '/^---/{p=1}p' > /tmp/patch.patch +apply_patch +clear_env -- cgit v1.2.3