Skip to content

Commit

Permalink
imp - Should work with spaces
Browse files Browse the repository at this point in the history
---

pushrepos and uprepos should work with folders with spaces in them.

---

Type: imp
Breaking: False
Doc Required: False
Backport Required: False
Part: 1/1
  • Loading branch information
AptiviCEO committed Oct 20, 2024
1 parent 24a6c37 commit cce6385
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions uprepos
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,33 @@
#

if ! command -v tput &> /dev/null; then
AQUA=""
ORANGE=""
RESET=""
AQUA=""
ORANGE=""
RESET=""
else
AQUA=$(tput setaf 45)
ORANGE=$(tput setaf 214)
RESET=$(tput sgr0)
AQUA=$(tput setaf 45)
ORANGE=$(tput setaf 214)
RESET=$(tput sgr0)
fi

enum_and_update() {
readarray -t maybe_gits < <( find "$1" -maxdepth 1 -name "*" -type d )
for maybe_git in "${maybe_gits[@]}"
do
if [[ ! -e "$maybe_git/.git" ]]; then
echo "${ORANGE}[*] ${RESET}Repo $maybe_git is not a git repo. Refusing to update..."
continue
fi
echo "${AQUA}[+] ${RESET}Updating $maybe_git..."
git -C $maybe_git fetch
git -C $maybe_git pull --recurse-submodule
git -C $maybe_git submodule update --remote
echo "${AQUA}[+] ${RESET}Update of $maybe_git done."
done
enum_and_update() {
readarray -t maybe_gits < <( find "$1" -mindepth 1 -maxdepth 1 -name "*" -type d )
for maybe_git in "${maybe_gits[@]}"
do
if [[ ! -e "$maybe_git/.git" ]]; then
echo "${ORANGE}[*] ${RESET}Repo $maybe_git is not a git repo. Refusing to update..."
continue
fi
echo "${AQUA}[+] ${RESET}Updating $maybe_git..."
git -C "$maybe_git" fetch
git -C "$maybe_git" pull --recurse-submodule
git -C "$maybe_git" submodule update --remote
echo "${AQUA}[+] ${RESET}Update of $maybe_git done."
done
}

if [[ -z $1 ]]; then
enum_and_update $PWD
enum_and_update $PWD
else
enum_and_update $1
enum_and_update "$1"
fi

0 comments on commit cce6385

Please sign in to comment.