The only thing we want to catch here is the command returning a non-zero
exit status, which is subprocess.CalledProcessError. We shouldn't
swallow any other exceptions.
Instead of creating empty commit orphan branches when the importer
starts, create them with a complete commit when first needed.
This changes the algorithm of adding a DSC commit from "add a new commit
assuming a dsc branch exists" to "add a new commit using the dsc branch
if it exists, or start one if it doesn't".
This is less error-prone because it eliminates the state dependency of
the add-new-dsc-commit algorithm. It also makes testing easier, because
there is no need to initialise anything.
Ideally I'd like to see
GitUbuntuRepository.ensure_importer_branches_exist disappear entirely.
For now, the do-not-push and pristine-tar orphan creation initalisation
remains, as this seems to be related to the way gbp works and will be a
separate effort to remove.
Ever since lxc gained snap support, it assumed that if SNAP is set in
it's environment that lxc itself was running as a SNAP. This is not
necessarily the case when git-ubuntu itself is a classic snap (and thus
has SNAP set in its environment) but is calling lxc in the host. Unset
SNAP manually on lxc run() calls.