github.com/camronlevanger/libcompose@v0.4.1-0.20180423130544-6bb86d53fa21/hack/validate-git-marks (about)

     1  #!/usr/bin/env bash
     2  
     3  source "$(dirname "$BASH_SOURCE")/.validate"
     4  
     5  # folders=$(find * -type d | egrep -v '^Godeps|bundles|.git')
     6  
     7  IFS=$'\n'
     8  files=( $(validate_diff --diff-filter=ACMR --name-only -- '*' | grep -v '^vendor/' || true) )
     9  unset IFS
    10  
    11  badFiles=()
    12  for f in "${files[@]}"; do
    13      if [ $(grep -r "^<<<<<<<" $f) ]; then
    14          badFiles+=( "$f" )
    15          continue
    16      fi
    17  
    18      if [ $(grep -r "^>>>>>>>" $f) ]; then
    19          badFiles+=( "$f" )
    20          continue
    21      fi
    22  
    23      if [ $(grep -r "^=======$" $f) ]; then
    24          badFiles+=( "$f" )
    25          continue
    26      fi
    27      set -e
    28  done
    29  
    30  
    31  if [ ${#badFiles[@]} -eq 0 ]; then
    32  	echo 'Congratulations!  There is no conflict.'
    33  else
    34  	{
    35  		echo "There is trace of conflict(s) in the following files :"
    36  		for f in "${badFiles[@]}"; do
    37  			echo " - $f"
    38  		done
    39  		echo
    40  		echo 'Please fix the conflict(s) commit the result.'
    41  		echo
    42  	} >&2
    43  	false
    44  fi