From 8181eda049251b8c46a208feb1d21b39f0281a57 Mon Sep 17 00:00:00 2001 From: Carlo Costino Date: Mon, 14 Apr 2025 15:45:03 -0400 Subject: [PATCH 1/2] Update Makefile to handle pre-existing git hooks This changeset adds a bit of extra support to the bootstrap command to make sure that pre-existing git hooks do not interfere with the installation of the pre-commit git hooks. Signed-off-by: Carlo Costino --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7025d9398..215e751af 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,8 @@ DATE = $(shell date +%Y-%m-%d:%H:%M:%S) APP_VERSION_FILE = app/version.py GIT_BRANCH ?= $(shell git symbolic-ref --short HEAD 2> /dev/null || echo "detached") -GIT_COMMIT ?= $(shell git rev-parse HEAD) +GIT_COMMIT ?= $(shell git rev-parse HEAD 2> /dev/null || echo "") +GIT_HOOKS_PATH ?= $(shell git config --global core.hooksPath || echo "") ## DEVELOPMENT @@ -18,7 +19,9 @@ bootstrap: ## Set up everything to run the app poetry self add poetry-dotenv-plugin poetry lock --no-update poetry install --sync --no-root + git config --global --unset-all core.hooksPath poetry run pre-commit install + git config --global core.hookspath "${GIT_HOOKS_PATH}" createdb notification_api || true createdb test_notification_api || true (poetry run flask db upgrade) || true From bf3897729c822836940e3398f54f0cb0a9fd7367 Mon Sep 17 00:00:00 2001 From: Carlo Costino Date: Mon, 14 Apr 2025 16:16:56 -0400 Subject: [PATCH 2/2] Create new command instead of trying to be fancy Signed-off-by: Carlo Costino --- Makefile | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Makefile b/Makefile index 215e751af..513196989 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,17 @@ GIT_HOOKS_PATH ?= $(shell git config --global core.hooksPath || echo "") .PHONY: bootstrap bootstrap: ## Set up everything to run the app + make generate-version-file + poetry self add poetry-dotenv-plugin + poetry lock --no-update + poetry install --sync --no-root + poetry run pre-commit install + createdb notification_api || true + createdb test_notification_api || true + (poetry run flask db upgrade) || true + +.PHONY: bootstrap-with-git-hooks +bootstrap-with-git-hooks: ## Sets everything up and accounts for pre-existing git hooks make generate-version-file poetry self add poetry-dotenv-plugin poetry lock --no-update