diff options
author | Guido Günther <agx@sigxcpu.org> | 2016-07-05 21:26:53 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2016-07-05 21:26:53 +0200 |
commit | 7ba43f653c44a7e1e453b59e37ae9f5ebc8ad6c4 (patch) | |
tree | 92c6ec8bd9d8ff43e514f444390422a786318df0 /gbp | |
parent | 2b333497ec670aa729c7f3f4390c19ae2aed6895 (diff) |
Improve check for empty_repository
Bases on a patch by Carlos Maddela
Closes: #791472
Diffstat (limited to 'gbp')
-rw-r--r-- | gbp/git/repository.py | 2 | ||||
-rw-r--r-- | gbp/scripts/import_orig.py | 4 |
2 files changed, 2 insertions, 4 deletions
diff --git a/gbp/git/repository.py b/gbp/git/repository.py index 7373a671..ba42be0a 100644 --- a/gbp/git/repository.py +++ b/gbp/git/repository.py @@ -886,7 +886,7 @@ class GitRepository(object): @rtype: C{bool} """ # an empty repo has no branches: - return False if self.branch else True + return len(self.get_local_branches()) == 0 def rev_parse(self, name, short=0): """ diff --git a/gbp/scripts/import_orig.py b/gbp/scripts/import_orig.py index 16ae9342..42be50c7 100644 --- a/gbp/scripts/import_orig.py +++ b/gbp/scripts/import_orig.py @@ -486,9 +486,7 @@ def main(argv): except GitRepositoryError: raise GbpError("%s is not a git repository" % (os.path.abspath('.'))) - # an empty repo has no branches: - initial_branch = repo.get_branch() - is_empty = False if initial_branch else True + is_empty = repo.is_empty() if not repo.has_branch(options.upstream_branch) and not is_empty: raise GbpError(no_upstream_branch_msg % options.upstream_branch) |