From: Don Zickus <[email protected]>

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 <[email protected]>

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
_______________________________________________
kernel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/[email protected]
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure

Reply via email to