summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--b4/__init__.py2
-rw-r--r--b4/pr.py8
2 files changed, 7 insertions, 3 deletions
diff --git a/b4/__init__.py b/b4/__init__.py
index 0f0b76c..b4ce2d4 100644
--- a/b4/__init__.py
+++ b/b4/__init__.py
@@ -1267,6 +1267,8 @@ def gpg_run_command(args, stdin=None, logstderr=False):
def git_run_command(gitdir, args, stdin=None, logstderr=False):
cmdargs = ['git', '--no-pager']
if gitdir:
+ if os.path.isdir(os.path.join(gitdir, '.git')):
+ gitdir = os.path.join(gitdir, '.git')
cmdargs += ['--git-dir', gitdir]
cmdargs += args
diff --git a/b4/pr.py b/b4/pr.py
index 24fbf64..55261f1 100644
--- a/b4/pr.py
+++ b/b4/pr.py
@@ -133,7 +133,7 @@ def fetch_remote(gitdir, lmsg, branch=None):
# Fetch it now
logger.info(' Fetching %s %s', lmsg.pr_repo, lmsg.pr_ref)
gitargs = ['fetch', lmsg.pr_repo, lmsg.pr_ref]
- ecode, out = b4.git_run_command(None, gitargs, logstderr=True)
+ ecode, out = b4.git_run_command(gitdir, gitargs, logstderr=True)
if ecode > 0:
logger.critical('ERROR: Could not fetch remote:')
logger.critical(out)
@@ -143,7 +143,7 @@ def fetch_remote(gitdir, lmsg, branch=None):
if branch:
gitargs = ['checkout', '-b', branch, 'FETCH_HEAD']
logger.info('Fetched into branch %s', branch)
- ecode, out = b4.git_run_command(None, gitargs)
+ ecode, out = b4.git_run_command(gitdir, gitargs)
if ecode > 0:
logger.critical('ERROR: Failed to create branch')
logger.critical(out)
@@ -156,7 +156,9 @@ def fetch_remote(gitdir, lmsg, branch=None):
def explode(gitdir, lmsg, savefile):
# We always fetch into FETCH_HEAD when exploding
- fetch_remote(gitdir, lmsg)
+ ecode = fetch_remote(gitdir, lmsg)
+ if ecode > 0:
+ sys.exit(ecode)
logger.info('Generating patches starting from the base-commit')
reroll = None
if lmsg.revision > 1: