mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2026-11-03 18:47:25 +09:00
Squashed commit of the following: commit 8ce89d6dab8031dadac7698e71a489edfffe29f8 Merge: 7b0052d69b76d10040Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Oct 16 16:58:28 2025 +0300 Merge branch 'master' into ADG-10852-rewrites-enabled commit 7b0052d6953cdc00c00c2f4a83ff8d71703c9bdd Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 15 18:09:34 2025 +0300 client: fix i18n commit 6ac47b30bbcad4a139a4f7ddd6bd4a21d9c783b7 Author: Eugene Miroshkin <e.miroshkin@adguard.com> Date: Wed Oct 15 07:56:16 2025 +0300 fix eslint commit 5e3841274894038ea4de7c4d82d4c099b48d5ae5 Author: Eugene Miroshkin <e.miroshkin@adguard.com> Date: Mon Oct 13 18:20:08 2025 +0300 add notify commit b7018efe07dc0742aa045df4986995111d934be7 Author: Eugene Miroshkin <e.miroshkin@adguard.com> Date: Mon Oct 13 18:06:35 2025 +0300 update ux commit 89fa121be13f2abc5fcfa89d23c0f75071b12fcb Author: Eugene Miroshkin <e.miroshkin@adguard.com> Date: Mon Oct 13 15:39:49 2025 +0300 update ux for rewrites page commit 2ed3a128f24c007db13f8e7de8ed69ef8ed6a920 Author: Eugene Miroshkin <e.miroshkin@adguard.com> Date: Fri Oct 10 16:11:06 2025 +0300 update frontend commit bb279f6b2e76be98ef3c26be587ea40c6c3ab180 Merge: 8ddc0a7af 497441d59 Author: Eugene Miroshkin <e.miroshkin@adguard.com> Date: Fri Oct 10 14:01:57 2025 +0300 merge commit 8ddc0a7afb3c6f8b80afd4a77f8f86e42f56bf63 Author: Eugene Miroshkin <e.miroshkin@adguard.com> Date: Fri Oct 10 14:01:37 2025 +0300 add rewrites toggle commit 497441d59557e883ee97e9081fc4730876a3edad Merge: 50a76760d2f810068aAuthor: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Oct 9 18:44:18 2025 +0300 Merge branch 'master' into ADG-10852-rewrites-enabled commit 50a76760db41115527a15e026e0eb766d93efb73 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Oct 9 18:25:52 2025 +0300 filtering: fix config write commit f1bf45aa422163c79be4f2afddd2b31ade269688 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Oct 3 14:21:53 2025 +0300 all: rewrites enabled
104 lines
2.6 KiB
Bash
Executable File
104 lines
2.6 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e -f -u
|
|
|
|
# This comment is used to simplify checking local copies of the script. Bump
|
|
# this number every time a significant change is made to this script.
|
|
#
|
|
# AdGuard-Project-Version: 5
|
|
|
|
# TODO(a.garipov): Add pre-merge-commit.
|
|
|
|
# Only show interactive prompts if there a terminal is attached to stdout.
|
|
# While this technically doesn't guarantee that reading from /dev/tty works,
|
|
# this should work reasonably well on all of our supported development systems
|
|
# and in most terminal emulators.
|
|
is_tty='0'
|
|
if [ -t '1' ]; then
|
|
is_tty='1'
|
|
fi
|
|
readonly is_tty
|
|
|
|
# prompt is a helper that prompts the user for interactive input if that can be
|
|
# done. If there is no terminal attached, it sleeps for two seconds, giving the
|
|
# programmer some time to react, and returns with a zero exit code.
|
|
prompt() {
|
|
if [ "$is_tty" -eq '0' ]; then
|
|
sleep 2
|
|
|
|
return 0
|
|
fi
|
|
|
|
while true; do
|
|
printf 'commit anyway? y/[n]: '
|
|
read -r ans </dev/tty
|
|
|
|
case "$ans" in
|
|
'y' | 'Y')
|
|
break
|
|
;;
|
|
'' | 'n' | 'N')
|
|
exit 1
|
|
;;
|
|
*)
|
|
continue
|
|
;;
|
|
esac
|
|
done
|
|
}
|
|
|
|
# Warn the programmer about unstaged changes and untracked files, but do not
|
|
# fail the commit, because those changes might be temporary or for a different
|
|
# branch.
|
|
#
|
|
# shellcheck disable=SC2016
|
|
awk_prog='substr($2, 2, 1) != "." { print $9; } $1 == "?" { print $2; }'
|
|
readonly awk_prog
|
|
|
|
unstaged="$(git status --porcelain=2 | awk "$awk_prog")"
|
|
readonly unstaged
|
|
|
|
if [ "$unstaged" != '' ]; then
|
|
printf 'WARNING: you have unstaged changes:\n\n%s\n\n' "$unstaged"
|
|
prompt
|
|
fi
|
|
|
|
# Warn the programmer about temporary todos and skel FIXMEs, but do not fail the
|
|
# commit, because the commit could be in a temporary branch.
|
|
temp_todos="$(
|
|
git grep -e 'FIXME' -e 'TODO.*!!' -- \
|
|
':!./scripts/hooks/pre-commit' \
|
|
':!./client' \
|
|
|| :
|
|
)"
|
|
readonly temp_todos
|
|
|
|
if [ "$temp_todos" != '' ]; then
|
|
printf 'WARNING: you have temporary todos:\n\n%s\n\n' "$temp_todos"
|
|
prompt
|
|
fi
|
|
|
|
verbose="${VERBOSE:-0}"
|
|
readonly verbose
|
|
|
|
if [ "$(git diff --cached --name-only -- '*.md' || :)" != '' ]; then
|
|
make VERBOSE="$verbose" md-lint
|
|
fi
|
|
|
|
if [ "$(git diff --cached --name-only -- '*.sh' || :)" != '' ]; then
|
|
make VERBOSE="$verbose" sh-lint
|
|
fi
|
|
|
|
if [ "$(git diff --cached --name-only -- '*.md' '*.json' '*.txt' '*.yaml' '*.yml' || :)" != '' ]; then
|
|
make VERBOSE="$verbose" txt-lint
|
|
fi
|
|
|
|
if [ "$(git diff --cached --name-only -- '*.go' '*.mod' 'Makefile' || :)" != '' ]; then
|
|
make VERBOSE="$verbose" go-os-check go-lint go-test
|
|
fi
|
|
|
|
# TODO(a.gairpov): Re-enable after finding a better linter.
|
|
# if [ "$(git diff --cached --name-only -- './openapi/openapi.yaml' || :)" != '' ]; then
|
|
# make VERBOSE="$verbose" openapi-lint
|
|
# fi
|