fix: do not unconditionally append $(GITEA_COMPATIBILITY) in version (#7933)

If the environment variable FORGEJO_VERSION is set and already contains $(GITEA_COMPATIBILITY), it must not be append again.

This particular use case occurs when a pull request is tested in https://code.forgejo.org/forgejo/end-to-end. It sets the version at

https://code.forgejo.org/forgejo/end-to-end/src/commit/796a32d6c15a0682e8027541950ab6e078e8b115/lib/build.sh#L39

which is drawn from a file generated at

https://codeberg.org/forgejo/forgejo/src/commit/6c6035bc492d965fa49a2e53a38301d622cea68a/.forgejo/cascading-pr-end-to-end#L33

The version is generated from a checkout of the PR which leads to
something like:

```
$ make show-version-full
12.0.0-dev-307-6c6035bc49+gitea-1.22.0
```

## Testing

```
git clone https://codeberg.org/forgejo/forgejo
cd forgejo
export FORGEJO_VERSION=$(make show-version-full)
test "$FORGEJO_VERSION" = "$(make show-version-full)" || echo FAIL!
```

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7933
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: Antonin Delpeuch <wetneb@noreply.codeberg.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
This commit is contained in:
Earl Warren
2025-05-22 12:14:31 +02:00
committed by Earl Warren
parent 6c6035bc49
commit de1adf224d
+1 -1
View File
@@ -94,7 +94,7 @@ else
# drop the "g" prefix prepended by git describe to the commit hash
FORGEJO_VERSION ?= $(shell git describe --exclude '*-test' --tags --always 2>/dev/null | sed 's/^v//' | sed 's/\-g/-/')
ifneq ($(FORGEJO_VERSION),)
ifneq ($(GITEA_COMPATIBILITY),)
ifeq ($(findstring $(GITEA_COMPATIBILITY),$(FORGEJO_VERSION)),)
FORGEJO_VERSION := $(FORGEJO_VERSION)+$(GITEA_COMPATIBILITY)
endif
endif