transport-helper: implement marks location as capability

Now that the gitdir location is exported as an environment variable
this can be implemented elegantly without requiring any explicit
flushes nor an ad-hoc exchange of values.

Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Sverre Rabbelier
2011-07-16 15:03:40 +02:00
committed by Junio C Hamano
parent 4d2ec306e8
commit a515ebe9f1
2 changed files with 29 additions and 42 deletions

View File

@ -72,6 +72,17 @@ def do_capabilities(repo, args):
print "export"
print "refspec refs/heads/*:%s*" % repo.prefix
dirname = repo.get_base_path(repo.gitdir)
if not os.path.exists(dirname):
os.makedirs(dirname)
path = os.path.join(dirname, 'testgit.marks')
print "*export-marks %s" % path
if os.path.exists(path):
print "*import-marks %s" % path
print # end capabilities
@ -147,19 +158,6 @@ def do_export(repo, args):
if not repo.gitdir:
die("Need gitdir to export")
dirname = repo.get_base_path(repo.gitdir)
if not os.path.exists(dirname):
os.makedirs(dirname)
path = os.path.join(dirname, 'testgit.marks')
print path
if os.path.exists(path):
print path
else:
print ""
sys.stdout.flush()
update_local_repo(repo)
changed = repo.importer.do_import(repo.gitdir)