utils:git

GIT

#!/usr/bin/env bash

update_git() {
    local dir="$1"

    for subdir in "$dir"/*; do
        echo "Going into $subdir"
        if [[ -d "$subdir" ]]; then
            cd "$subdir" || exit
            if [[ -d .git ]]; then
                echo "actions todo into git folder"
            else
                update_git "$subdir"
            fi  
            cd -
        fi  
    done
}

if [[ "$1" == "" ]]; then
    dir_to_update=$(pwd)
else
    dir_to_update="$1"
fi

for dir in "${dir_to_update}"/* ; do
    case $(basename "$dir") in
        puppet)
            echo "Going into $dir"
            update_git "$dir"
            ;;  
        *)  
            echo "$dir not managed"
            ;;  
    esac
done
  • utils/git.txt
  • Last modified: 2024/10/14 20:59
  • by 127.0.0.1