[OS-BUILD PATCH] redhat/Makefile.common: Fix 'fatal: Not a valid object name master' error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Prarit Bhargava <prarit@xxxxxxxxxx>

Hey everyone,

I spent 5-10 mins looking at the 'fatal: Not a valid object name master' error
this morning.  It comes from the redhat/Makefile.common:45

  MERGE_BASE:=$(shell git merge-base HEAD master)

There is no master branch so 'git merge-base HEAD master' returns an error
with message 'fatal: Not a valid object name master'.

If I add a Makefile target to dump the MERGE_BASE, TAG, and SNAPSHOT
variables I get

MERGE_BASE= TAG=v5.8-rc7-1028-g305981a20220 SNAPSHOT=1

I thought about changing the MERGE_BASE value to

MERGE_BASE:=$(shell git merge-base HEAD master >& /dev/null && git merge-base HEAD master || git merge-base HEAD upstream/master)

but that seems really clunky.  Anyone have a better idea?  Maybe it should only
be

MERGE_BASE:$(git merge-base HEAD upstream/master) ?

In any case, after changing the MERGE_BASE line in Makefile.common, and
dumping the values the 'fatal' error no longer occurs and MERGE_BASE
is set correctly:

MERGE_BASE=d3590ebf6f91350192737dd1d1b219c05277f067 TAG=v5.8-rc7-39-gd3590ebf6f91 SNAPSHOT=1

P.

---8<----

Executing some redhat/Makefile targets results in a

     'fatal: Not a valid object name master'

error.  This occurs because MERGE_BASE is calculated against the master
branch which may not exist.

Check to see if master branch exists and if it doesn't use upstream/master
instead.

Signed-off-by: Prarit Bhargava <prarit@xxxxxxxxxx>
---
 redhat/Makefile.common | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/redhat/Makefile.common b/redhat/Makefile.common
index 6d048415ba6d..e67f2c9dec50 100644
--- a/redhat/Makefile.common
+++ b/redhat/Makefile.common
@@ -41,8 +41,7 @@ else
   VERSION_ON_UPSTREAM:=0
 endif
 ifeq ($(VERSION_ON_UPSTREAM),1)
-  # master is expected to track mainline.
-  MERGE_BASE:=$(shell git merge-base HEAD master)
+  MERGE_BASE:=$(shell git merge-base HEAD master >& /dev/null && git merge-base HEAD master || git merge-base HEAD upstream/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')
-- 
GitLab
_______________________________________________
kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx
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/kernel@xxxxxxxxxxxxxxxxxxxxxxx




[Index of Archives]     [Fedora General Discussion]     [Older Fedora Users Archive]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Coolkey]     [Yum Users]     [Tux]     [Yosemite News]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [USB]     [Asterisk PBX]

  Powered by Linux