Browse Source

Solving fjood from git outside a repo

Jules Latsague 6 years ago
parent
commit
7f920b80f0
2 changed files with 8 additions and 7 deletions
  1. 0
    1
      README.md
  2. 8
    6
      gitagile.sh

+ 0
- 1
README.md View File

@@ -35,6 +35,5 @@ Pour plus d'informations, utiliser l'options -h
35 35
 
36 36
 ## TODO
37 37
 - Tester le processus d'installation en entier
38
-- Gérer le flood de l'initialisation des dépôts
39 38
 - Définir dynamiquement l'emplacement de l'executable de git
40 39
 

+ 8
- 6
gitagile.sh View File

@@ -78,14 +78,16 @@ create_liste() {
78 78
 deploy() {
79 79
     mv $GIT_PATH $GIT_PATH.bk
80 80
     echo "#!/bin/sh
81
-if [ \"\$(cat ~/.gitagile | grep \$(basename -s .git `/usr/lib/git-core/git config --get remote.origin.url`))\" ]; then
82
-    if [ \"\$1\" = \"push\" ]; then
83
-        if [ \"\$(/usr/lib/git-core/git branch | grep \'^* master\')\" ] || [ \"\$(/usr/lib/git-core/git branch | grep \'^* sprint-\')\" ]; then
84
-            \/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\"
85
-            exit
81
+if [ -d .git ]; then
82
+    if [ \"\$(cat ~/.gitagile | grep \$(basename -s .git `/usr/lib/git-core/git config --get remote.origin.url`))\" ]; then
83
+        if [ \"\$1\" = \"push\" ]; then
84
+            if [ \"\$(/usr/lib/git-core/git branch | grep \'^* master\')\" ] || [ \"\$(/usr/lib/git-core/git branch | grep \'^* sprint-\')\" ]; then
85
+                \/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\"
86
+                exit
87
+            fi
86 88
         fi
87 89
     fi
88
-fi
90
+fi    
89 91
     $GIT_APP_PATH \$@" > $GIT_PATH
90 92
 }
91 93
 

Loading…
Cancel
Save