From af766f3f2c64023de98d008dc9b6061510bf714c Mon Sep 17 00:00:00 2001 From: Oliver Chang Date: Thu, 7 May 2020 17:19:57 +1000 Subject: bisector: always reset projects/ even when we exception out. (#3769) --- infra/bisector.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'infra/bisector.py') diff --git a/infra/bisector.py b/infra/bisector.py index 8a5b78a1..4e88bd8e 100644 --- a/infra/bisector.py +++ b/infra/bisector.py @@ -296,16 +296,15 @@ def bisect(bisect_type, old_commit, new_commit, test_case_path, fuzz_target, Raises: ValueError: when a repo url can't be determine from the project. """ - result = _bisect(bisect_type, old_commit, new_commit, test_case_path, + try: + return _bisect(bisect_type, old_commit, new_commit, test_case_path, fuzz_target, build_data) - - # Clean up projects/ as _bisect may have modified it. - oss_fuzz_repo_manager = repo_manager.BaseRepoManager(helper.OSS_FUZZ_DIR) - oss_fuzz_repo_manager.git(['reset', 'projects']) - oss_fuzz_repo_manager.git(['checkout', 'projects']) - oss_fuzz_repo_manager.git(['clean', '-fxd', 'projects']) - - return result + finally: + # Clean up projects/ as _bisect may have modified it. + oss_fuzz_repo_manager = repo_manager.BaseRepoManager(helper.OSS_FUZZ_DIR) + oss_fuzz_repo_manager.git(['reset', 'projects']) + oss_fuzz_repo_manager.git(['checkout', 'projects']) + oss_fuzz_repo_manager.git(['clean', '-fxd', 'projects']) if __name__ == '__main__': -- cgit v1.2.3