Create a script that replace git to check branch, and repository to prevent push
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Jules Latsague 2b1acb8cc1 Update demo script in README 6 years ago
README.md Update demo script in README 6 years ago
gitagile.sh Solving fjood from git outside a repo 6 years ago

README.md

Git-Agile

Créer un script qui intersède les appels à Git afin d’interdire les « push » pour les branches déclarées dans le fichier voulu

Fonctionnement

Les fichiers dans /usr/bin de systèmes debian-based sont appelé par défaut depuis le terminal. Un script du nom de git va effectuer des tests (selon l’action, la branche et le dépôts ) avant d’afficher un message d’erreur ou de passer ces arguments à git

Installation

Le script fournit permet de génerer le script d’intercession

#!/bin/sh
if [ -d .git ]; then
    if [ "$(cat ~/.gitagile | grep $(basename -s .git `/usr/lib/git-core/git config --get remote.origin.url`))" ]; then
        if [ "$1" = "push" ]; then
            if [ "$(/usr/lib/git-core/git branch | grep '^* master')" ] || [ "$(/usr/lib/git-core/git branch | grep '^* sprint-')" ]; then
                /bin/echo -e "033[1;31m ⚠ Current branch is protected.033[0m\nNo push allowed\nSee $PROTECT_LIST to change it or bypass it in invocating $GIT_APP_PATH \n"
                exit
            fi
        fi
    fi
fi
$GIT_APP_PATH $@

Il dépand de plusieurs variables qui seront préciser lors de leur déploiement. Le script d’installation permet de passer en parametres ces variables. Par example :

sh gitagile.sh -p ~/.gitagile -b gitagile webserver

La liste des branches sera crée dans ~/.gitagile, avec les branches gitagile webserver.

Pour plus d’informations, utiliser l’options -h

TODO

  • Tester le processus d’installation en entier
  • Définir dynamiquement l’emplacement de l’executable de git