git_update_all_branches.sh: improved functions

This commit is contained in:
Oliver Schraml 2018-08-30 14:04:02 +02:00 committed by suchademon
parent 6211b64059
commit 54aa247e8e
Signed by: oliver.schraml
GPG Key ID: A55864B79D0D0228
1 changed files with 2 additions and 4 deletions

View File

@ -35,7 +35,7 @@ then
fi
branchges=$(${BINgit} -C "${gitreppath}" br -a | grep -v remotes | grep -v "remotes/origin/HEAD" | wc -l)
activebranch="$(${BINgit} -C "${gitreppath}" branch | grep "\*" | awk '{print $2}')"
activebranch="$(${BINgit} -C "${gitreppath}" branch | grep -E "^\*" | awk '{print $2}')"
HIDECURSOR
echo -e ""
@ -47,13 +47,11 @@ echo -e " x x"
echo -e " mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj"
WRITE
for f in $(${BINgit} -C "${gitreppath}" br -a | grep -v remotes | awk '{print $1}')
for f in $(${BINgit} -C "${gitreppath}" br -a | grep -v remotes | sed -E 's/\* //g' | awk '{print $1}')
do
#echo "Updateing[${branchcounter}/${branchges}]: ${f}"
showBar ${branchcounter} ${branchges} ${f} "[$((${branchcounter} + 1))/${branchges}]" #Call bar drawing function "showBar"
${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"
${BINgit} -C "${gitreppath}" checkout "${activebranch}" --quiet