diff options
author | Guido Günther <agx@sigxcpu.org> | 2016-09-09 13:35:41 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2016-09-12 08:52:14 +0200 |
commit | 7a7068d14ab34e47d44bd601db201fb4126751ef (patch) | |
tree | 226d8095fbb4e08d2a389c0d59a51609055e6591 /gbp | |
parent | bc187422ddfd561d244e78a8826f58a0ff018713 (diff) |
create_remote_repo: allow to create non bare repositories
Closes: #837158
Diffstat (limited to 'gbp')
-rw-r--r-- | gbp/config.py | 6 | ||||
-rw-r--r-- | gbp/scripts/create_remote_repo.py | 23 |
2 files changed, 22 insertions, 7 deletions
diff --git a/gbp/config.py b/gbp/config.py index ddbf6601..4e1581e7 100644 --- a/gbp/config.py +++ b/gbp/config.py @@ -1,6 +1,6 @@ # vim: set fileencoding=utf-8 : # -# (C) 2006,2007,2010-2012,2015 Guido Guenther <agx@sigxcpu.org> +# (C) 2006,2007,2010-2012,2015,2016 Guido Guenther <agx@sigxcpu.org> # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or @@ -174,6 +174,7 @@ class GbpOptionParser(OptionParser): 'upstream-vcs-tag': '', 'rollback': 'True', 'component': [], + 'bare': 'True', } help = { 'debian-branch': @@ -339,6 +340,9 @@ class GbpOptionParser(OptionParser): "Rollback repository changes when encountering an error", 'component': 'component name for additional tarballs', + 'bare': + "wether to create a bare repository on the remote side. " + "'Default is '%(bare)s'.", } def_config_files = {'/etc/git-buildpackage/gbp.conf': 'system', diff --git a/gbp/scripts/create_remote_repo.py b/gbp/scripts/create_remote_repo.py index 29d9986f..ed8a8720 100644 --- a/gbp/scripts/create_remote_repo.py +++ b/gbp/scripts/create_remote_repo.py @@ -70,7 +70,7 @@ def print_config(remote, branches): merge = refs/heads/%s""" % (branch, remote['name'], branch)) -def parse_url(remote_url, name, pkg, template_dir=None): +def parse_url(remote_url, name, pkg, template_dir=None, bare=True): """ Sanity check our remote URL @@ -110,7 +110,8 @@ def parse_url(remote_url, name, pkg, template_dir=None): 'port': port, 'name': name, 'scheme': scheme, - 'template-dir': template_dir} + 'template-dir': template_dir, + 'bare': bare} return remote @@ -120,7 +121,14 @@ def build_remote_script(remote, branch): """ args = remote args['branch'] = branch - args['git-init-args'] = '--bare --shared' + args['git-init-args'] = '--shared' + if args['bare']: + args['git-init-args'] += ' --bare' + args['checkout_cmd'] = '' + args['git_dir'] = '.' + else: + args['checkout_cmd'] = 'git checkout -f' + args['git_dir'] = '.git' if args['template-dir']: args['git-init-args'] += (' --template=%s' % args['template-dir']) @@ -135,8 +143,8 @@ def build_remote_script(remote, branch): 'mkdir -p %(base)s"%(dir)s"', 'cd %(base)s"%(dir)s"', 'git init %(git-init-args)s', - 'echo "%(pkg)s packaging" > description', - 'echo "ref: refs/heads/%(branch)s" > HEAD', + 'echo "%(pkg)s packaging" > %(git_dir)s/description', + 'echo "ref: refs/heads/%(branch)s" > %(git_dir)s/HEAD', ''] remote_script = '\n'.join(remote_script_pattern) % args return remote_script @@ -219,6 +227,8 @@ def build_parser(name, sections=[]): dest="pristine_tar") branch_group.add_boolean_config_file_option(option_name="track", dest='track') + branch_group.add_boolean_config_file_option(option_name="bare", + dest='bare') parser.add_option("-v", "--verbose", action="store_true", dest="verbose", @@ -308,7 +318,8 @@ def main(argv): remote = parse_url(options.remote_url, options.name, pkg, - options.template_dir) + options.template_dir, + options.bare) if repo.has_remote_repo(options.name): raise GbpError("You already have a remote name '%s' defined for this repository." % options.name) |