Merge branch 'master' of ssh://sparda:/git/scripts

This commit is contained in:
Oliver Schraml 2018-07-27 09:14:46 +00:00 committed by suchademon
parent 4cbd6e1b7a
commit affdec1bfa
Signed by: oliver.schraml
GPG Key ID: A55864B79D0D0228
1 changed files with 22 additions and 7 deletions

View File

@ -1,7 +1,7 @@
#!/bin/bash
branchges=$(git br -a | grep remotes | grep -v "remotes/origin/HEAD" | wc -l)
gitreppath="$(pwd)"
BINgit="/usr/bin/git"
branchcounter=0
activebranch="$(git branch | grep "\*" | awk '{print $2}')"
PUT(){ echo -en "\033[${1};${2}H";}
DRAW(){ echo -en "\033%";echo -en "\033(0";}
@ -22,26 +22,41 @@ function showBar {
}
# Start Script
clear
if ! [ -z "${1}" ]
then
if [ -d "${1}" ]
then
gitreppath="${1}"
else
echo "${1} is not a path"
exit 1
fi
fi
branchges=$(${BINgit} -C "${gitreppath}" br -a | grep remotes | grep -v "remotes/origin/HEAD" | wc -l)
activebranch="$(${BINgit} -C "${gitreppath}" branch | grep "\*" | awk '{print $2}')"
HIDECURSOR
echo -e ""
echo -e ""
echo -e " GIT UPDATE BRANCHES IS RUNNING"
echo -e " GIT MODULE: ${gitreppath}"
echo -e " UPDATE BRANCHES IS RUNNING"
DRAW #magic starts here - must use caps in draw mode
echo -e " lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk"
echo -e " x x"
echo -e " mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj"
WRITE
for f in $(git br -a | grep remotes | grep -v "remotes/origin/HEAD" | awk '{print $1}' | cut -f3 -d\/)
for f in $(${BINgit} -C "${gitreppath}" br -a | grep remotes | grep -v "remotes/origin/HEAD" | awk '{print $1}' | cut -f3 -d\/)
do
#echo "Updateing[${branchcounter}/${branchges}]: ${f}"
showBar ${branchcounter} ${branchges} ${f} "[$((${branchcounter} + 1))/${branchges}]" #Call bar drawing function "showBar"
git checkout "${f}" --quiet && git pull --rebase origin "${f}" --quiet >/dev/null 2>&1
${BINgit} -C "${gitreppath}" checkout "${f}" --quiet && ${BINgit} -C ${gitreppath} pull --rebase origin "${f}" --quiet >/dev/null 2>&1
branchcounter=$((${branchcounter} + 1))
#showBar ${branchcounter} ${branchges} ${f} "[$((${branchcounter} + 1))/${branchges}]" #Call bar drawing function "showBar"
done
showBar ${branchcounter} ${branchges} ${f} "[${branchcounter}/${branchges}]" #Call bar drawing function "showBar"
git checkout "${activebranch}" --quiet
${BINgit} -C "${gitreppath}" checkout "${activebranch}" --quiet
PUT 10 12
echo -e ""