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/scripts/create_remote_repo.py | |
parent | bc187422ddfd561d244e78a8826f58a0ff018713 (diff) |
create_remote_repo: allow to create non bare repositories
Closes: #837158
Diffstat (limited to 'gbp/scripts/create_remote_repo.py')
-rw-r--r-- | gbp/scripts/create_remote_repo.py | 23 |
1 files changed, 17 insertions, 6 deletions
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) |