From 92a29d392ce2334c5e0021b9c48be335723e7f3c Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Mon, 9 Dec 2013 16:19:54 +0200 Subject: [PATCH] export: determine remote repo name from git config Instead of trying to guess it from the remote tracking branch name which can be ambigous. Change-Id: I029c3fadb6f9ea63fa1c280e7183deba56c0e7ff Signed-off-by: Markus Lehtonen --- gitbuildsys/cmd_export.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/gitbuildsys/cmd_export.py b/gitbuildsys/cmd_export.py index e991a95..ef8725d 100644 --- a/gitbuildsys/cmd_export.py +++ b/gitbuildsys/cmd_export.py @@ -120,11 +120,16 @@ def create_gbp_export_args(repo, commit, export_dir, tmp_dir, spec, args, remotename = 'origin' if 'origin' in remotes else remotes.keys()[0] # Take the remote repo of current branch, if available try: - remote_branch = repo.get_upstream_branch(repo.branch) - if remote_branch: - remotename = remote_branch.split("/")[0] - except GitRepositoryError: + config_remote = repo.get_config('branch.%s.remote' % repo.branch) + except KeyError: pass + else: + if config_remote in remotes: + remotename = config_remote + elif config_remote != '.': + log.warning("You appear to have non-existent remote '%s' " + "configured for branch '%s'. Check your git config!" + % (config_remote, repo.branch)) reponame = urlparse(remotes[remotename][0]).path.lstrip('/') packaging_dir = get_packaging_dir(args) -- 2.34.1