From 541ed6ed37d23fa9b1693aca582e1aad25497ce2 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Fri, 15 May 2020 17:16:11 +0100 Subject: lorry: Add support for git push options Gerrit requires passing the skip-validation option when pushing a branch with a long history. Add a 'push-option' application setting that allows adding any such option to the git push command. Closes #2. --- lorry | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'lorry') diff --git a/lorry b/lorry index 7505633..c33f60d 100755 --- a/lorry +++ b/lorry @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# Copyright (C) 2013-2019 Codethink Limited +# Copyright (C) 2013-2020 Codethink Limited # # 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 @@ -98,6 +98,9 @@ class Lorry(cliapp.Application): self.settings.boolean(['keep-multiple-backups'], 'keep multiple (time-stamped) backups (disabled by default)', default=False) + self.settings.string_list(['push-option'], + "option for 'git push' to pass to the " + 'remote server') def process_args(self, args): status = 0 @@ -531,7 +534,11 @@ class Lorry(cliapp.Application): self.run_program(['git', 'init', '--bare', pushurl], cwd=gitdir) self.progress('.. pushing %s to mirror server %s' % (name, pushurl)) - self.run_program(['git', 'push', pushurl]+pushrefspecs, cwd=gitdir) + self.run_program(['git', 'push'] + + ['--push-option=%s' % option + for option in self.settings['push-option']] + + [pushurl] + pushrefspecs, + cwd=gitdir) def run_program(self, argv, **kwargs): if self.settings['command-stdout']: -- cgit v1.2.1