Created
January 29, 2016 13:12
-
-
Save aereal/64d4a1319763f8658ede to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
repo_sig=$1 | |
repos_root="$(ghq root)" | |
repo_path="${repos_root}/${repo_sig}" | |
if [[ ! -d "$repo_path/.git" ]]; then | |
echo "! ${repo_path} is not a Git repository" >&2 | |
exit 1 | |
fi | |
if git -C $repo_path rev-parse '@{u}' >/dev/null 2>&1; then | |
if [[ "$(git -C $repo_path rev-list --left-only --count '...@{u}')" -ne 0 ]]; then | |
echo "! ${repo_path} has changes" >&2 | |
exit 1 | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment