libmicrohttpd2

HTTP server C library (MHD 2.x, alpha)
Log | Files | Refs | README | LICENSE

commit a09cd5e92c107a2c9e779714bd6b4dbf13590eb5
parent b78948ba7dd06ee9b7ccbc2bb0b5f6478969bd14
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Date:   Sun, 25 May 2025 19:44:26 +0200

bootstrap: updated to set required git parameters

Can be backported

Diffstat:
Mbootstrap | 74++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------
1 file changed, 58 insertions(+), 16 deletions(-)

diff --git a/bootstrap b/bootstrap @@ -96,30 +96,72 @@ if have_cmd ${UNCRUSTIFY}; then cp contrib/uncrustify.cfg uncrustify.cfg || \ echo "Failed to install uncrustify configuration file" 1>&2 fi - if test -f uncrustify.cfg; then - if test -d '.git'; then - if ver_cmp `git --version 2>/dev/null | ver_filter` -lt "1.5.5.2"; then - echo "git version 1.5.5.2 (or later) not detected; pre-commit hook not installed." + else + echo "Uncrustify version $UNCRUSTIFY_VER detected, hook not installed. Please install uncrustify $UNCRUSTIFY_VER_NEEDED or newer if you plan to contribute to development." + fi +else + echo "Uncrustify not detected, hook not installed. Please install uncrustify $UNCRUSTIFY_VER_NEEDED or newer if you plan to contribute to development." +fi + +test -n "$GIT" || GIT="$GIT_CMD" +test -n "$GIT" || GIT="$GIT_BINARY" +test -n "$GIT" || GIT="git" + +if test -d '.git'; then + if have_cmd "$GIT"; then + ver_GIT=`"$GIT" --version 2>/dev/null | ver_filter` + if ver_cmp "$ver_GIT" -lt "1.7"; then + echo "git version $ver_GIT detected. If you plan to contribute to development, consider installing a modern Git version." + else + if test -f '.git/mhd2_special_config'; then :; else + git_settings_modified='no' + if ver_cmp "$ver_GIT" -ge "1.7.9"; then + if git_set_VAL=`"$GIT" config --get --local --bool 'pull.rebase' 2>/dev/null` && test "$git_set_VAL" = "true"; then :; else + echo "Setting 'pull.rebase' to 'true' for this repository." + "$GIT" config --local 'pull.rebase' 'true' && git_settings_modified='yes' + fi + else + if git_set_VAL=`"$GIT" config --get --local 'branch.autoSetupRebase' 2>/dev/null` && test "$git_set_VAL" = "always"; then :; else + echo "Setting 'branch.autoSetupRebase' to 'always' for this repository." + "$GIT" config --local 'branch.autoSetupRebase' 'always' && git_settings_modified='yes' + fi + fi + if ver_cmp "$ver_GIT" -ge "2.6"; then + if git_set_VAL=`"$GIT" config --get --local --bool 'rebase.autoStash' 2>/dev/null` && test "$git_set_VAL" = "true"; then :; else + echo "Setting 'rebase.autoStash' to 'true' for this repository." + "$GIT" config --local 'rebase.autoStash' 'true' && git_settings_modified='yes' + fi + fi + if test "$git_settings_modified" != "no"; then + echo "Some git repository settings has been modified." + echo "Use next command to prevent such modifications in the future:" + echo " touch '.git/mhd2_special_config'" + fi + fi + if test -f uncrustify.cfg && have_cmd ${UNCRUSTIFY}; then + if test -f .git/hooks/pre-commit; then + echo "Pre-commit git hook already exists, skipping installation from the upstream file." else - if test -f .git/hooks/pre-commit; then - echo "Pre-commit git hook already exists, skipping installation from the upstream file." - else - echo "Installing uncrustify pre-commit git hook" - rm -f ./.git/hooks/pre-commit - ln -s ../../contrib/precommit_hook.sh .git/hooks/pre-commit || \ - cp contrib/precommit_hook.sh .git/hooks/pre-commit || \ - echo "Failed to install pre-commit git hook" 1>&2 + echo "Installing uncrustify pre-commit git hook" + rm -f ./.git/hooks/pre-commit + ln -s ../../contrib/precommit_hook.sh .git/hooks/pre-commit || \ + cp contrib/precommit_hook.sh .git/hooks/pre-commit || \ + echo "Failed to install pre-commit git hook" 1>&2 + if test -f "${GIT_DIR-.git}/hooks/pre-commit"; then + if dir_GIT_HOOKS=`"$GIT" config --get core.hooksPath 2>/dev/null` && test "X$dir_GIT_HOOKS" != "X.git/hooks"; then + echo "Installed hook will not be used due to git configuration." + echo "Consider updating git configuration by running the following command:" + echo " '$GIT' config --local core.hooksPath .git/hooks" + fi fi fi - else - echo "No '.git' directory found, skipping installation of pre-commit git hook." fi fi else - echo "Uncrustify version $UNCRUSTIFY_VER detected, hook not installed. Please install uncrustify $UNCRUSTIFY_VER_NEEDED or newer if you plan to contribute to development." + echo "No 'git' command detected, skipping installation of pre-commit git hook and git configuration." fi else - echo "Uncrustify not detected, hook not installed. Please install uncrustify $UNCRUSTIFY_VER_NEEDED or newer if you plan to contribute to development." + echo "No '.git' directory found, skipping installation of pre-commit git hook and git configuration." fi WANT_AUTOCONF=latest