8a12d4808bd304a353c77bf2eed9ade16578172a
braney
  Tue Feb 26 14:18:44 2019 -0800
when we're disconnecting assembly hubs, we need to remove any custom
tracks loaded on it

diff --git src/hg/lib/cart.c src/hg/lib/cart.c
index 44fe127..9179ddd 100644
--- src/hg/lib/cart.c
+++ src/hg/lib/cart.c
@@ -1259,30 +1259,34 @@
     while ((ex = *exclude++))
 	cartExclude(cart, ex);
     }
 return cart;
 }
 
 static void doDisconnectHub(struct cart *cart)
 {
 char *id = cartOptionalString(cart, "hubId");
 
 if (id != NULL)
     {
     char buffer[1024];
     safef(buffer, sizeof buffer, "hgHubConnect.hub.%s", id);
     cartRemove(cart, buffer);
+
+    // now we need to remove any custom tracks that are on this hub
+    safef(buffer, sizeof buffer, "ctfile_hub_%s", id);
+    cartRemovePrefix(cart, buffer);
     }
 
 cartRemove(cart, "hubId");
 cartRemove(cart, hgHubDoDisconnect);
 }
 
 static void hideIfNotInCart(struct cart *cart, char *track)
 /* If this track is not mentioned in the cart, set it to hide */
 {
 if (cartOptionalString(cart, track) == NULL)
     cartSetString(cart, track, "hide");
 }
 
 void cartHideDefaultTracks(struct cart *cart)
 /* Hide all the tracks who have default visibilities in trackDb