git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Roskin <proski@gnu.org>
To: git@vger.kernel.org, Catalin Marinas <catalin.marinas@gmail.com>
Subject: [PATCH] Catch more exceptions in compat_log_entry()
Date: Tue, 22 Oct 2013 10:31:26 -0400	[thread overview]
Message-ID: <20131022143126.11775.85272.stgit@IRBT4585> (raw)

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:

             reply	other threads:[~2013-10-22 14:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-22 14:31 Pavel Roskin [this message]
2013-11-06 10:27 ` [PATCH] Catch more exceptions in compat_log_entry() Catalin Marinas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131022143126.11775.85272.stgit@IRBT4585 \
    --to=proski@gnu.org \
    --cc=catalin.marinas@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).