allrepos[name] = 1
# If this is a remote repository, don't try to create it if it's not there -
# this is handled by the repository importer.
- if remoterepo and not os.path.isdir("%s/repos/%s" % (self.conf.get("paths", "githome"), name)):
+ if remoterepo and not os.path.isdir("%s/repos/%s.git" % (self.conf.get("paths", "githome"), name)):
continue
# Check if this repository exists at all
- if not os.path.isdir("%s/repos/%s" % (self.conf.get("paths", "githome"), name)):
+ if not os.path.isdir("%s/repos/%s.git" % (self.conf.get("paths", "githome"), name)):
# Does not exist, let's initialize a new one
- os.environ['GIT_DIR'] = "%s/repos/%s"% (self.conf.get("paths", "githome"), name)
+ os.environ['GIT_DIR'] = "%s/repos/%s.git"% (self.conf.get("paths", "githome"), name)
if initialclone:
print "Initializing git into %s (cloned repo %s)" % (name, initialclone)
if initialclone.startswith('git://'):
oldrepo = initialclone
else:
# This is a local reference, so rewrite it based on our root
- oldrepo = "%s/repos/%s" % (self.conf.get("paths", "githome"), initialclone)
- os.system("git clone --bare %s %s/repos/%s" % (
+ oldrepo = "%s/repos/%s.git" % (self.conf.get("paths", "githome"), initialclone)
+ os.system("git clone --bare %s %s/repos/%s.git" % (
# Old repo
oldrepo,
# New repo
# Check for publishing options here
if web:
f.write("%s %s\n" % (urllib.quote_plus(name), urllib.quote_plus(owner)))
- df = open("%s/repos/%s/description" % (self.conf.get("paths", "githome"), name), "w")
+ df = open("%s/repos/%s.git/description" % (self.conf.get("paths", "githome"), name), "w")
df.write(description)
df.close()
- anonfile = "%s/repos/%s/git-daemon-export-ok" % (self.conf.get("paths", "githome"), name)
- htafile = "%s/repos/%s/.htaccess" % (self.conf.get("paths", "githome"), name)
+ anonfile = "%s/repos/%s.git/git-daemon-export-ok" % (self.conf.get("paths", "githome"), name)
+ htafile = "%s/repos/%s.git/.htaccess" % (self.conf.get("paths", "githome"), name)
if anon:
if not os.path.isfile(anonfile):
open(anonfile, "w").close()
for d in os.listdir("%s/repos/" % self.conf.get("paths", "githome")):
if d.startswith('.'):
continue
+ if d.endswith('.git'):
+ d = d[:-4]
if not allrepos.has_key(d):
print "Removing repository %s" % d
try:
- shutil.rmtree("%s/repos/%s" % (self.conf.get("paths", "githome"), d))
+ shutil.rmtree("%s/repos/%s.git" % (self.conf.get("paths", "githome"), d))
except Exception,e:
print "FAIL: unable to remove directory: %s" % e
self.path = os.path.normpath(("%s%s" % (self.repoprefix, args[2:].rstrip("'"))))
if not self.path.startswith(self.repoprefix):
raise InternalException("Escaping the root directory is of course not permitted")
+ if not self.path.endswith('.git'):
+ raise InternalException("Git repository paths must end in .git")
if not os.path.exists(self.path):
raise InternalException('git repository "%s" does not exist' % args)
- self.subpath = self.path[len(self.repoprefix):]
+ self.subpath = self.path[len(self.repoprefix):-4]
def check_permissions(self):
writeperm = False
self.name = name
self.remoteurl = remoteurl
self.remotemodule = remotemodule
- self.repopath = "%s/repos/%s" % (self.conf.get("paths", "githome"), self.name)
+ self.repopath = "%s/repos/%s.git" % (self.conf.get("paths", "githome"), self.name)
os.environ['GIT_DIR'] = self.repopath
def initialsync(self):
# We really only use this for the main repo, so way too lazy to set
# this up now. Do it manually ;-)
- raise NotImplementedError("Sorry, initial sync for rsync-cvs not implemnted")
+ raise NotImplementedError("Sorry, initial sync for rsync-cvs not implemented")
def normalsync(self):
rsyncpath = "%s/rsyncsrc/%s" % (self.conf.get("paths", "githome"), self.name)