aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xgbp/scripts/export_orig.py11
-rw-r--r--tests/05_test_detection.py5
2 files changed, 11 insertions, 5 deletions
diff --git a/gbp/scripts/export_orig.py b/gbp/scripts/export_orig.py
index c2885014..13be4f91 100755
--- a/gbp/scripts/export_orig.py
+++ b/gbp/scripts/export_orig.py
@@ -236,12 +236,13 @@ def guess_comp_type(comp_type, source, repo, tarball_dir):
if comp_type == 'auto':
branch = None
- if repo.has_branch('pristine-tar'):
- branch = 'pristine-tar'
- elif repo.has_branch('origin/pristine-tar', remote=True):
- branch = 'origin/pristine-tar'
+ if repo:
+ if repo.has_branch('pristine-tar'):
+ branch = 'pristine-tar'
+ elif repo.has_branch('origin/pristine-tar', remote=True):
+ branch = 'origin/pristine-tar'
- if branch:
+ if branch is not None:
regex = r'pristine-tar .* %s_%s\.orig.tar\.' % (source.name, source.upstream_version)
commits = repo.grep_log(regex, branch, merges=False)
if commits:
diff --git a/tests/05_test_detection.py b/tests/05_test_detection.py
index d6322335..c4831fbf 100644
--- a/tests/05_test_detection.py
+++ b/tests/05_test_detection.py
@@ -139,3 +139,8 @@ class TestDetection(unittest.TestCase):
guessed = export_orig.guess_comp_type(
'gz', self.source, repo, None)
self.assertEqual("gzip", guessed)
+
+ def test_guess_comp_type_no_repo(self):
+ guessed = export_orig.guess_comp_type(
+ 'auto', self.source, None, str(self.tmpdir))
+ self.assertEqual('gzip', guessed)