Commit 0cf75312 authored by xuwang's avatar xuwang
Browse files

feat(help): show pinned OTICA_VERSION and checked-out ref in make help



The `make help` header now prints the pin and what is actually checked
out, e.g. `OTICA_VERSION=v1.2.0 (checked out: v1.2.0)`.

Resolution is detached-HEAD safe (pinning to a release tag leaves
${OTICA_DIR} detached): branch -> exact tag -> short SHA, each guarded,
so help never emits "fatal: ref HEAD is not a symbolic ref". Gives
consumers a sanctioned way to read their version instead of hand-rolling
a bare `git symbolic-ref HEAD`.

Changelog: added
Co-Authored-By: default avatarClaude Opus 4.8 <noreply@anthropic.com>
parent 36f77996
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -47,6 +47,13 @@ help: ## show this help page, use "help=<filter>" for more specific helps

	@# adapted from https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
	@echo OTICA_DIR=${OTICA_DIR}
	@# Show the pin and what is actually checked out. Detached-HEAD safe (a pin to
	@# a release tag leaves ${OTICA_DIR} detached): branch -> exact tag -> short SHA.
	@printf 'OTICA_VERSION=%s (checked out: %s)\n' '${OTICA_VERSION}' "$$( \
		git -C ${OTICA_DIR} symbolic-ref --quiet --short HEAD 2>/dev/null \
		|| git -C ${OTICA_DIR} describe --tags --exact-match 2>/dev/null \
		|| git -C ${OTICA_DIR} rev-parse --short HEAD 2>/dev/null \
		|| echo unknown)"
	@echo
	@printf '==== \e[1;35m%-6s\e[m ====' "MAKEFILE TARGETS FOR DIRECTORY: $$(basename $$PWD)/"
	@#for f in ${MAKEFILE_LIST}