From 1f4be1183144c95d7b1a13c6fcfb2ea787d9c396 Mon Sep 17 00:00:00 2001 From: luowei Date: Wed, 18 Dec 2024 07:14:50 +0000 Subject: [PATCH 1/2] Modify the version number format to make it more easily understandable for humans. --- Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d5172cb82..e242bd705 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,11 @@ ################################## Parameter Definition And Check ########################################## -override GIT_VERSION = $(shell git rev-parse --abbrev-ref HEAD)${CUSTOM} $(shell git rev-parse HEAD) +# 1. 如果HEAD存在tag,则GIT_VERSION= +# e.g. 3.2411.0 a6355ff4cf8d181315a2b30341bc954b29576b11 +# e.g. 3.2412.0-pre1-1 f0bcb90e712cbdb6e16f122c1ebd623e90f9a905 +# 2. 如果HEAD没有tag,则GIT_VERSION=<分支名> +# e.g. main a6355ff4cf8d181315a2b30341bc954b29576b11 +# e.g. release-3.2411.x a6355ff4cf8d181315a2b30341bc954b29576b11 +override GIT_VERSION = $(shell if git describe --exact-match --tags >/dev/null 2>&1; then git describe --exact-match --tags | sed 's/^v//'; else git rev-parse --abbrev-ref HEAD; fi)${CUSTOM} $(shell git rev-parse HEAD) override GIT_COMMIT = $(shell git rev-parse HEAD) override PROJECT_NAME = sqle override LDFLAGS = -ldflags "-X 'main.version=${GIT_VERSION}'" From 7410bb804490424ad9e497711bfc520892a88456 Mon Sep 17 00:00:00 2001 From: luowei <36940986+ColdWaterLW@users.noreply.github.com> Date: Wed, 18 Dec 2024 15:45:19 +0800 Subject: [PATCH 2/2] make annotation more detail --- Makefile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index e242bd705..05bc56147 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,11 @@ ################################## Parameter Definition And Check ########################################## -# 1. 如果HEAD存在tag,则GIT_VERSION= -# e.g. 3.2411.0 a6355ff4cf8d181315a2b30341bc954b29576b11 -# e.g. 3.2412.0-pre1-1 f0bcb90e712cbdb6e16f122c1ebd623e90f9a905 +# 1. 如果HEAD存在tag,则GIT_VERSION=<版本名称> +# PS: 通常会在版本名称前增加字符“v”作为tag内容,当版本名称为 3.2411.0时,tag内容为v3.2411.0 +# e.g. tag为v3.2411.0时,GIT_VERSION=3.2411.0 a6355ff4cf8d181315a2b30341bc954b29576b11 +# e.g. tag为v3.2412.0-pre1-1时,GIT_VERSION=3.2412.0-pre1-1 f0bcb90e712cbdb6e16f122c1ebd623e90f9a905 # 2. 如果HEAD没有tag,则GIT_VERSION=<分支名> -# e.g. main a6355ff4cf8d181315a2b30341bc954b29576b11 -# e.g. release-3.2411.x a6355ff4cf8d181315a2b30341bc954b29576b11 +# e.g. 分支名为main时,GIT_VERSION=main a6355ff4cf8d181315a2b30341bc954b29576b11 +# e.g. 分支名为release-3.2411.x时,GIT_VERSION=release-3.2411.x a6355ff4cf8d181315a2b30341bc954b29576b11 override GIT_VERSION = $(shell if git describe --exact-match --tags >/dev/null 2>&1; then git describe --exact-match --tags | sed 's/^v//'; else git rev-parse --abbrev-ref HEAD; fi)${CUSTOM} $(shell git rev-parse HEAD) override GIT_COMMIT = $(shell git rev-parse HEAD) override PROJECT_NAME = sqle