github.com/docker/libcompose@v0.4.1-0.20210616120443-2a046c0bdbf2/hack/.validate (about)

     1  #!/bin/bash
     2  
     3  if [ -z "$VALIDATE_UPSTREAM" ]; then
     4  	# this is kind of an expensive check, so let's not do this twice if we
     5  	# are running more than one validate bundlescript
     6  	
     7  	VALIDATE_REPO='https://github.com/docker/libcompose.git'
     8  	VALIDATE_BRANCH='master'
     9  	
    10  	if [ "$TRAVIS" = 'true' -a "$TRAVIS_PULL_REQUEST" != 'false' ]; then
    11  		VALIDATE_REPO="https://github.com/${TRAVIS_REPO_SLUG}.git"
    12  		VALIDATE_BRANCH="${TRAVIS_BRANCH}"
    13  	fi
    14  	
    15  	VALIDATE_HEAD="$(git rev-parse --verify HEAD)"
    16  	
    17  	git fetch -q "$VALIDATE_REPO" "refs/heads/$VALIDATE_BRANCH"
    18  	VALIDATE_UPSTREAM="$(git rev-parse --verify FETCH_HEAD)"
    19  	
    20  	VALIDATE_COMMIT_LOG="$VALIDATE_UPSTREAM..$VALIDATE_HEAD"
    21  	VALIDATE_COMMIT_DIFF="$VALIDATE_UPSTREAM...$VALIDATE_HEAD"
    22  	
    23  	validate_diff() {
    24  		if [ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]; then
    25  			git diff "$VALIDATE_COMMIT_DIFF" "$@"
    26  		fi
    27  	}
    28  	validate_log() {
    29  		if [ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]; then
    30  			git log "$VALIDATE_COMMIT_LOG" "$@"
    31  		fi
    32  	}
    33  fi