diff options
author | Næþ'n Lasseter <Næþ'n Lasseter nathan@bytemark.co.uk> | 2016-08-25 14:22:29 +0100 |
---|---|---|
committer | Næþ'n Lasseter <Næþ'n Lasseter nathan@bytemark.co.uk> | 2016-08-25 14:22:29 +0100 |
commit | be45dcad9491e809d13145baab5e6ea1caf80791 (patch) | |
tree | 7144a6ca8f90c37a600f050e6ad48d535535186e /incoming/pre-local/00-git-pull |
Initial Commit
Diffstat (limited to 'incoming/pre-local/00-git-pull')
-rwxr-xr-x | incoming/pre-local/00-git-pull | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/incoming/pre-local/00-git-pull b/incoming/pre-local/00-git-pull new file mode 100755 index 0000000..4e42eb2 --- /dev/null +++ b/incoming/pre-local/00-git-pull @@ -0,0 +1,20 @@ +#!/bin/bash + +function pull_and_update_repo { + git pull +} + +function test_if_working_directory_clean { + git status 2>&1 | grep 'nothing.*commit' > /dev/null && pull_and_update_repo +} + +function test_if_in_repo_root { + [ -d .git ] && test_if_working_directory_clean +} + +function test_if_git_repo { + git status 2>&1 | grep 'fatal: Not a git repository' > /dev/null || test_if_in_repo_root +} + +test_if_git_repo +exit 0 |