diff options
author | Saverio Miroddi <saverio.pub2@gmail.com> | 2018-02-07 02:02:35 +0300 |
---|---|---|
committer | Dennis Schubert <mail@dennis-schubert.de> | 2018-02-10 18:13:38 +0300 |
commit | 1ebb5dd72dd7f4565c2c22fa5579a78341988103 (patch) | |
tree | c20d9b83a9bd0840a24352dcd0317a1de31963ab | |
parent | f8ce276ddcf0c362fa3b27a7aa1f306f16c7b975 (diff) |
Don't print a warning when starting the server outside a Git repo
Currently, git checks are performed on server start, even when outside a git
repository.
This commit verify the presence of a git repository (via `git status` exit
code), and perform checks only if it exists.
closes #7712
-rw-r--r-- | Changelog.md | 1 | ||||
-rwxr-xr-x | script/server | 22 |
2 files changed, 14 insertions, 9 deletions
diff --git a/Changelog.md b/Changelog.md index ed020a0f9..8be378cab 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,6 +1,7 @@ # 0.7.4.0 ## Refactor +* Don't print a warning when starting the server outside a Git repo [#7712](https://github.com/diaspora/diaspora/pull/7712) ## Bug fixes diff --git a/script/server b/script/server index bcfda9e2d..214377694 100755 --- a/script/server +++ b/script/server @@ -63,16 +63,20 @@ fi command -v git > /dev/null 2>&1 if [ $? -eq 0 ]; then - # Check if git merge is in progress - if [ -f .git/MERGE_MODE ]; then - fatal "A git merge is in progress!" - fi - - # Check if detached head state - git_branch_name="$(git symbolic-ref HEAD 2>/dev/null)" - if [ -z "$git_branch_name" ]; + # Check if we're in a repository, before doing any verification. + if git status > /dev/null 2>&1; then - warning "You are in detached HEAD state!" + # Check if git merge is in progress + if [ -f .git/MERGE_MODE ]; then + fatal "A git merge is in progress!" + fi + + # Check if detached head state + git_branch_name="$(git symbolic-ref HEAD 2>/dev/null)" + if [ -z "$git_branch_name" ]; + then + warning "You are in detached HEAD state!" + fi fi fi |