[Frugalware-darcs] vmexam: dg: handle if we're not in a git repo

VMiklos vmiklos at frugalware.org
Fri Jun 15 19:57:24 CEST 2007


Darcsweb-Url: http://darcs.frugalware.org/darcsweb/darcsweb.cgi?r=vmexam;a=darcs_commitdiff;h=20070615174441-e2957-76d6b9289ea458d9d848a90fe701c56aea3bfc06.gz;

[dg: handle if we're not in a git repo
VMiklos <vmiklos at frugalware.org>**20070615174441] {
hunk ./python/dg.py 56
+def emptydir(dir):
+	ret = True
+	for root, dirs, files in os.walk(dir):
+		for file in files:
+			ret = False
+			break
+		if not ret:
+			break
+	return ret
+
+def get_root():
+	sock = os.popen("git rev-parse --git-dir")
+	root = sock.read().strip()
+	if sock.close():
+		sys.exit(0)
+	return root
+
hunk ./python/dg.py 673
+		# this will exit if no root found
+		get_root()
}


More information about the Frugalware-darcs mailing list