summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathon Jongsma <jonathon@quotidian.org>2009-08-26 23:25:15 -0500
committerOwen W. Taylor <otaylor@fishsoup.net>2009-08-29 11:32:14 -0400
commit795ff39a29df7fdc5b854bd77534bc1939feebc7 (patch)
tree810fc2d225075f52ab257ad3cafe3584f2386da0
parentff5b2c48fca8ff34134d981f8d1ac207b1d5e2a2 (diff)
Improve error handling when bug reference is incorrect
If the user specifies the bug url on the command line but the url violates our assumptions, git-bz doesn't currently handle it well. For instance, the following commandline invocation: git bz attach http://bugzilla.foo.org HEAD will fail the regex that checks whether it is a bugzilla url (since it is missing show_bug.cgi), so it will interpret it as a 'alias:1234'-style reference. 'http' is interpreted as the alias, but when that is not found in the git config, it will attempt to look up a browser cookie for the host 'http'. That will also fail, but it will report a misleading error which is something like: Please log in to 'http' in Firefox This patch just does a little sanity checking that the bug id is a number and aborts with a slightly more helpful error message if that is not true.
-rwxr-xr-xgit-bz3
1 files changed, 3 insertions, 0 deletions
diff --git a/git-bz b/git-bz
index 751af8d..e91cce3 100755
--- a/git-bz
+++ b/git-bz
@@ -481,6 +481,9 @@ def resolve_bug_reference(bug_reference):
tracker = get_tracker()
id = bug_reference
+ if not id.isdigit():
+ die("Invalid bug reference '%s'" % bug_reference)
+
host = resolve_host_alias(tracker)
https = tracker_uses_https(tracker)