From 3575cf7c02c05555343a140ac6fca60e6582f3de Mon Sep 17 00:00:00 2001 From: David Paz Date: Sun, 17 Jul 2022 11:33:21 +0200 Subject: [PATCH] Remove unused try catch Since return code from cmd_output is ignored the try catch can be ignored. --- pre_commit_hooks/prepare_commit_msg.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pre_commit_hooks/prepare_commit_msg.py b/pre_commit_hooks/prepare_commit_msg.py index f9613ae..27b8aee 100644 --- a/pre_commit_hooks/prepare_commit_msg.py +++ b/pre_commit_hooks/prepare_commit_msg.py @@ -6,16 +6,12 @@ from typing import Sequence from jinja2 import Template -from pre_commit_hooks.util import CalledProcessError from pre_commit_hooks.util import cmd_output from pre_commit_hooks.util import get_template_path def get_current_branch() -> str: - try: - ref_name = cmd_output('git', 'symbolic-ref', '--short', 'HEAD') - except CalledProcessError: - return '' + ref_name = cmd_output('git', 'symbolic-ref', '--short', 'HEAD') return ref_name.strip()