fix some things

This commit is contained in:
piecka 2025-03-25 09:35:50 +01:00
parent f7019152eb
commit 16ae092321

23
.zshrc
View file

@ -354,25 +354,27 @@ __alias__() {
alias gcm="git commit -m" alias gcm="git commit -m"
alias gpu="git push --recurse-submodule=on-demand" alias gpu="git push --recurse-submodule=on-demand"
gsu() { gsu() {
echo "| git submodule foreach git pull --recurse-submodule |" echo "${YELLOW}${BOLD}| git submodule foreach git pull --recurse-submodule |${NC}"
git submodule foreach git pull --recurse-submodule && git submodule foreach git pull --recurse-submodule &&
echo "-- pulled down submodules recursively" echo "${CYAN}-- pulled down submodules recursively${NC}"
echo "| git submodule update --init --recursive |" echo "${YELLOW}| git submodule update --init --recursive |${NC}"
git submodule update --init --recursive git submodule update --init --recursive &&
echo "${CYAN}-- updated submodules recursively${NC}"
echo "-- Checking submodule branches... --" echo "${YELLOW}-- Checking submodule branches... --${NC}"
git submodule foreach ' git submodule foreach '
branch=$(git symbolic-ref --short HEAD 2>/dev/null || echo "detached") branch=$(git symbolic-ref --short HEAD 2>/dev/null || echo "detached")
if [ "$branch" = "detached" ]; then if [ "$branch" = "detached" ]; then
default_branch=$(git config -f $toplevel/.gitmodules submodule.$name.branch || echo "main") default_branch=$(git config -f $toplevel/.gitmodules submodule.$name.branch || echo "main")
echo "Submodule $name is detached. Checking out $default_branch..." echo "${RED}Submodule $name is detached. Checking out $default_branch...${NC}"
git checkout $default_branch git checkout $default_branch
else else
echo "Submodule $name is on branch $branch." echo "${CYAN}Submodule $name is on branch $branch.${NC}"
fi fi
' '
gUpdateModules() {
if git diff --quiet .; then if git diff --quiet .; then
echo_info "Staging changes..." echo_info "Staging changes..."
git add . git add .
@ -386,6 +388,9 @@ __alias__() {
else else
echo_info "No changes to commit." echo_info "No changes to commit."
fi fi
}
gUpdateModules
if git push; then if git push; then
echo_info "Push successful." echo_info "Push successful."
@ -393,6 +398,10 @@ __alias__() {
echo_error "Failed to push changes." echo_error "Failed to push changes."
return 1 return 1
fi fi
# gUpdateModules
error_log
} }
gwip() { gwip() {