in file crt/src/crt/cmds/release.py
This imports git.exc.GitError (gitpython's base exception), NOT
crt.crtlib.git_utils.GitError (the project's CRTError subclass). The
project's git utility functions raise crt.crtlib.git_utils.GitError, so the
except GitError clauses actually catch gitpython's lower-level exceptions
rather than (or in addition to) the intended ones. They do happen to also catch
the crtlib GitError only because gitpython's GitError is broader.
Pre-existing issue, but interacts with new code: _prepare_release_repo
(line ~79) and _prepare_release_branches (line ~120) both use except GitError. The crtlib functions will raise crtlib's GitError, and these except
blocks catch gitpython's GitError instead. This works accidentally because
gitpython's GitError inherits from Exception, and the crtlib GitError also
inherits from Exception. But the catch is NOT type-correct -- it catches the
wrong type hierarchy.
Severity: Medium (works by accident; should import from crt.crtlib.git_utils)
in file
crt/src/crt/cmds/release.pyThis imports
git.exc.GitError(gitpython's base exception), NOTcrt.crtlib.git_utils.GitError(the project'sCRTErrorsubclass). Theproject's git utility functions raise
crt.crtlib.git_utils.GitError, so theexcept GitErrorclauses actually catch gitpython's lower-level exceptionsrather than (or in addition to) the intended ones. They do happen to also catch
the crtlib
GitErroronly because gitpython'sGitErroris broader.Pre-existing issue, but interacts with new code:
_prepare_release_repo(line ~79) and
_prepare_release_branches(line ~120) both useexcept GitError. The crtlib functions will raise crtlib'sGitError, and theseexceptblocks catch gitpython's
GitErrorinstead. This works accidentally becausegitpython's
GitErrorinherits fromException, and the crtlibGitErroralsoinherits from
Exception. But the catch is NOT type-correct -- it catches thewrong type hierarchy.
Severity: Medium (works by accident; should import from
crt.crtlib.git_utils)