From 1ebb5dd72dd7f4565c2c22fa5579a78341988103 Mon Sep 17 00:00:00 2001 From: Saverio Miroddi Date: Wed, 7 Feb 2018 00:02:35 +0100 Subject: [PATCH] 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 --- Changelog.md | 1 + script/server | 22 +++++++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Changelog.md b/Changelog.md index ed020a0f95f..8be378cab0c 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 bcfda9e2d2d..21437769466 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