Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capture GitCommandError in log file #1232

Merged
merged 2 commits into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/1232.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
If `git` fails to update a template in the cookiecutter cache, the `git` command and output are now captured in the Briefcase log file.
9 changes: 6 additions & 3 deletions src/briefcase/commands/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,10 +772,12 @@ def update_cookiecutter_cache(self, template: str, branch="master"):
# Attempt to update the repository
remote = repo.remote(name="origin")
remote.fetch()
except self.tools.git.exc.GitCommandError:
except self.tools.git.exc.GitCommandError as e:
# We are offline, or otherwise unable to contact
# the origin git repo. It's OK to continue; but warn
# the user that the template may be stale.
# the origin git repo. It's OK to continue; but
# capture the error in the log and warn the user
# that the template may be stale.
self.logger.debug(str(e))
self.logger.warning(
"""
*************************************************************************
Expand All @@ -789,6 +791,7 @@ def update_cookiecutter_cache(self, template: str, branch="master"):
*************************************************************************
"""
)

try:
# Check out the branch for the required version tag.
head = remote.refs[branch]
Expand Down