From af2d64e9cfe7f7bf725878dbade73a1ee8f11ebe Mon Sep 17 00:00:00 2001 From: Russell Martin Date: Tue, 25 Apr 2023 12:03:17 -0400 Subject: [PATCH 1/2] Capture `GitCommandError` in log file --- src/briefcase/commands/base.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/briefcase/commands/base.py b/src/briefcase/commands/base.py index cedf54120..b434bc211 100644 --- a/src/briefcase/commands/base.py +++ b/src/briefcase/commands/base.py @@ -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( """ ************************************************************************* @@ -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] From 7e79b9a35146a18e32e7d025846210ba24fb4146 Mon Sep 17 00:00:00 2001 From: Russell Martin Date: Tue, 25 Apr 2023 12:09:37 -0400 Subject: [PATCH 2/2] Add changenote. --- changes/1232.misc.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changes/1232.misc.rst diff --git a/changes/1232.misc.rst b/changes/1232.misc.rst new file mode 100644 index 000000000..8d8bf7016 --- /dev/null +++ b/changes/1232.misc.rst @@ -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.