diff options
Diffstat (limited to 'gbp/scripts/dch.py')
-rw-r--r-- | gbp/scripts/dch.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gbp/scripts/dch.py b/gbp/scripts/dch.py index 59e920b1..18e86de7 100644 --- a/gbp/scripts/dch.py +++ b/gbp/scripts/dch.py @@ -423,8 +423,10 @@ def main(argv): return ExitCodes.parse_error try: + old_cwd = os.path.abspath(os.path.curdir) try: - repo = DebianGitRepository('.') + repo = DebianGitRepository('.', toplevel=False) + os.chdir(repo.path) except GitRepositoryError: raise GbpError("%s is not a git repository" % (os.path.abspath('.'))) @@ -566,6 +568,8 @@ def main(argv): if str(err): gbp.log.err(err) ret = 1 + finally: + os.chdir(old_cwd) return ret |