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
This commit is contained in:
Saverio Miroddi 2018-02-07 00:02:35 +01:00 committed by Dennis Schubert
parent f8ce276ddc
commit 1ebb5dd72d
No known key found for this signature in database
GPG key ID: 5A0304BEA7966D7E
2 changed files with 14 additions and 9 deletions

View file

@ -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

View file

@ -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