init playbook on localhost
This commit is contained in:
		
							parent
							
								
									38cf0c62bf
								
							
						
					
					
						commit
						6ff53974e3
					
				
					 1 changed files with 4 additions and 17 deletions
				
			
		| 
						 | 
					@ -1,34 +1,21 @@
 | 
				
			||||||
#!/usr/bin/env bash
 | 
					#!/usr/bin/env bash
 | 
				
			||||||
 | 
					 | 
				
			||||||
shopt -s nullglob
 | 
					shopt -s nullglob
 | 
				
			||||||
declare -a FILES
 | 
					declare -a FILES
 | 
				
			||||||
declare -a HIT
 | 
					declare -a HIT
 | 
				
			||||||
 | 
					 | 
				
			||||||
echo "Git hook executing: pre-commit..."
 | 
					echo "Git hook executing: pre-commit..."
 | 
				
			||||||
 | 
					FILES=($(git diff --cached --name-only --diff-filter=ACM))
 | 
				
			||||||
# dump staged filenames into FILES array
 | 
					 | 
				
			||||||
FILES=(`git diff --cached --name-only --diff-filter=ACM`)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
n=0
 | 
					n=0
 | 
				
			||||||
for i in "${FILES[@]}"; do
 | 
					for i in "${FILES[@]}"; do
 | 
				
			||||||
    WARN=`file --mime "${i}" | grep -i binary`
 | 
					    WARN=$(file --mime "${i}" | grep -i binary)
 | 
				
			||||||
    NAME=`file "${i}" | cut -d":" -f1`
 | 
					    NAME=$(file "${i}" | cut -d":" -f1)
 | 
				
			||||||
 | 
					 | 
				
			||||||
    if [ -n "${WARN}" ]; then
 | 
					    if [ -n "${WARN}" ]; then
 | 
				
			||||||
        HIT[$n]="${NAME}"
 | 
					        HIT[$n]="${NAME}"
 | 
				
			||||||
        WARN=""
 | 
					        WARN=""
 | 
				
			||||||
        echo "${NAME} appears to be a binary blob."
 | 
					        echo "${NAME} appears to be a binary blob."
 | 
				
			||||||
        exit 1
 | 
					        exit 1
 | 
				
			||||||
    elif [[ "${NAME}" == *"blah" ]]; then
 | 
					 | 
				
			||||||
        true
 | 
					 | 
				
			||||||
        # do some stuff here
 | 
					 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
        true
 | 
					 | 
				
			||||||
        # do some other stuff here
 | 
					 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
    let "n++"
 | 
					    let "n++"
 | 
				
			||||||
done
 | 
					done
 | 
				
			||||||
 | 
					 | 
				
			||||||
if [ ${#HIT[@]} -gt 0 ]; then
 | 
					if [ ${#HIT[@]} -gt 0 ]; then
 | 
				
			||||||
    echo "  WARNING: Binary data found"
 | 
					    echo "WARNING: Binary data found"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue