From: Don Zickus <dzickus(a)redhat.com>
Use upstream/master for merge-base with fallback to master
In Makefile.common there is logic that determines what the
merge-base is and is used to generate changelogs correctly.
The logic assumes a 'master' branch exists and is up to date.
However, the documentation recommends using 'upstream/master' to
keep everything up to date.
Let's sync the documentation and code and use upstream/master if
it exists otherwise, use 'master' as the fallback. If neither
exists error out.
The 'error' out solves another problem when a master branch is not
defined not is 'upstream' used as recommended.
Signed-off-by: Don Zickus <dzickus(a)redhat.com>
diff a/redhat/Makefile.common b/redhat/Makefile.common
--- a/redhat/Makefile.common
+++ b/redhat/Makefile.common
@@ -48,7 +48,12 @@ else
endif
ifeq ($(VERSION_ON_UPSTREAM),1)
# master is expected to track mainline.
- MERGE_BASE:=$(shell $(GIT) merge-base $(HEAD) master)
+ MASTER:=$(shell $(GIT) rev-parse -q --verify upstream/master || \
+ $(GIT) rev-parse -q --verify master)
+ ifeq ($(MASTER),)
+ $(error "Missing an 'upstream/master' or 'master'
branch")
+ endif
+ MERGE_BASE:=$(shell $(GIT) merge-base $(HEAD) $(MASTER))
_TAG:=$(shell $(GIT) describe $(MERGE_BASE))
# a snapshot off of a tagged git is of the form [tag]-[cnt]-g[hash]
SNAPSHOT:=$(shell echo $(_TAG) | grep -c '\-g')
--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/995