e80987afe15e233e7b256ab1fcdd58d6f4ff914a
braney
  Fri Sep 12 14:16:58 2014 -0700
fix hgHubConnect to deal with bad hubs less confusing by staying inhgHubConnect if connecting to the hub fails. #13992

diff --git src/hg/lib/hubConnect.c src/hg/lib/hubConnect.c
index 055fdd7..fa1d8b5 100644
--- src/hg/lib/hubConnect.c
+++ src/hg/lib/hubConnect.c
@@ -493,42 +493,52 @@
 int id = 0;
 
 *errorMessage = NULL;
 
 if ((id = getHubId(url, errorMessage)) > 0)
     return id;
 
 getAndSetHubStatus( cart, url, FALSE);
 
 if ((id = getHubId(url, errorMessage)) == 0)
     errAbort("inserted new hubUrl %s, but cannot find it", url);
 
 return id;
 }
 
+// global to hold hubUrl we added if any
+struct hubConnectStatus  *gNewHub;
+
+struct hubConnectStatus  *hubConnectNewHub()
+/* return the hub for the hubUrl we added (if any) */
+{
+return gNewHub;
+}
+
 static char  *checkForNew( struct cart *cart)
 /* see if the user just typed in a new hub url, return id if so */
 {
 struct hubConnectStatus *hub;
 char *url = cartOptionalString(cart, hgHubDataText);
 char *newDatabase = NULL;
 
 if (url == NULL)
     return NULL;
 
 trimSpaces(url);
-hub = getAndSetHubStatus( cart, url, TRUE);
+
+gNewHub = hub = getAndSetHubStatus( cart, url, TRUE);
 cartRemove(cart, hgHubDataText);
 
 char *wantFirstDb = cartOptionalString(cart, hgHubDoFirstDb);
 if ((wantFirstDb != NULL) && (hub->trackHub != NULL))
     newDatabase = hub->trackHub->defaultDb;
 
 cartRemove(cart, hgHubDoFirstDb);
 return newDatabase;
 }
 
 unsigned hubResetError(char *url)
 /* clear the error for this url in the hubStatus table,return the id */
 {
 struct sqlConnection *conn = hConnectCentral();
 char query[512];