diff options
-rw-r--r-- | gbp/git/repository.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gbp/git/repository.py b/gbp/git/repository.py index 0396367..502a391 100644 --- a/gbp/git/repository.py +++ b/gbp/git/repository.py @@ -538,10 +538,13 @@ class GitRepository(object): if not self.has_branch(branch, remote=remote): raise GitRepositoryError("Branch %s doesn't exist!" % branch) + if self._cmd_has_feature('branch', 'set-upstream-to'): + args = ['--set-upstream-to=%s' % upstream, local_branch] + else: + args = ["--set-upstream", local_branch, upstream] + dummy, err, ret = self._git_inout('branch', - ['--set-upstream', - local_branch, - upstream], + args, capture_stderr=True) if ret: raise GitRepositoryError( |