git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Catch more exceptions in compat_log_entry()

From
PRPavel Roskin <proski@gnu.org>
Date
Oct 22, 2013, 14:31 UTC
Message-ID
<20131022143126.11775.85272.stgit@IRBT4585>

Catch exceptions in default_repo(). Catch git.RepositoryException. This suppresses stack trace in "stg pull" on detached head and outside the repository.

Signed-off-by: Pavel Roskin <proski@gnu.org>
---
 stgit/lib/log.py |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/stgit/lib/log.py b/stgit/lib/log.py
index dfadd51..d876ff6 100644
--- a/stgit/lib/log.py
+++ b/stgit/lib/log.py
@@ -359,10 +359,10 @@ class Fakestack(object):
 def compat_log_entry(msg):
     """Write a new log entry. (Convenience function intended for use by
     code not yet converted to the new infrastructure.)"""
-    repo = default_repo()
     try:
+        repo = default_repo()
         stack = repo.get_stack(repo.current_branch_name)
-    except libstack.StackException, e:
+    except (libstack.StackException, git.RepositoryException), e:
         out.warn(str(e), 'Could not write to stack log')
     else:
         if repo.default_index.conflicts() and stack.patchorder.applied:
Next: Catalin Marinas
Message 1 of 2 in “Catch more exceptions in compat_log_entry()”
  1. Catch more exceptions in compat_log_entry()Pavel Roskin, Oct 22, 2013
  2. Catalin MarinasNov 6, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.