[oe] Getting "fatal: Not a git repository"

Tom Rini trini at kernel.crashing.org
Wed Mar 4 21:59:21 UTC 2009


On Wed, Mar 04, 2009 at 04:54:56PM -0500, Mark Butsch wrote:

> Hello,
> 
> I am getting the message "fatal: Not a git repository" when I build. It
> doesn't seem to be causing a problem, but it bothers me none the less.

Totally untested:

diff --git a/classes/base.bbclass b/classes/base.bbclass
index 18afc1a..d716bcb 100644
--- a/classes/base.bbclass
+++ b/classes/base.bbclass
@@ -807,7 +807,7 @@ def base_get_metadata_svn_revision(d):
 
 def base_get_metadata_git_branch(d):
 	import os
-	branch = os.popen('cd %s; git branch | grep "^* " | tr -d "* "' % base_get_scmbasepath(d)).read()
+	branch = os.popen('cd %s; git branch 2>/dev/null | grep "^* " | tr -d "* "' % base_get_scmbasepath(d)).read()
 
 	if len(branch) != 0:
 		return branch
@@ -815,7 +815,7 @@ def base_get_metadata_git_branch(d):
 
 def base_get_metadata_git_revision(d):
 	import os
-	rev = os.popen("cd %s; git log -n 1 --pretty=oneline --" % base_get_scmbasepath(d)).read().split(" ")[0]
+	rev = os.popen("cd %s; git log -n 1 --pretty=oneline -- 2>/dev/null" % base_get_scmbasepath(d)).read().split(" ")[0]
 	if len(rev) != 0:
 		return rev
 	return "<unknown>"

-- 
Tom Rini




More information about the Openembedded-devel mailing list