b02d20dede590203b6ecca10be473e7e22179a51
braney
  Thu Jan 12 13:12:53 2023 -0800
deal with some weird edge cases in hub that Hiram's hub illicit.   Don't
read a single trackDb.txt file more than once even if it's referenced
from mulitple hubs.  Also, only the first time a genome is defined does
it get to populate its own groups.  Subsequent examples get put into
their own group, just like a normal track hub does.

diff --git src/hg/inc/hubConnect.h src/hg/inc/hubConnect.h
index 3f00115..b20d100 100644
--- src/hg/inc/hubConnect.h
+++ src/hg/inc/hubConnect.h
@@ -138,33 +138,35 @@
 /* clear the error for this url in the hubStatus table,return the id */
 
 unsigned hubClearStatus(char *url);
 /* drop the information about this url from the hubStatus table,return the id */
 
 void hubDisconnect(struct cart *cart, char *url);
 /* drop the information about this url from the hubStatus table, and 
  * the cart variable the references this hub */
 
 void hubUpdateStatus(char *errorMessage, struct hubConnectStatus *hub);
 /* set the error message in the hubStatus table */
 
 boolean trackHubHasDatabase(struct trackHub *hub, char *database) ;
 /* Return TRUE if hub has contents for database */
 
-struct trackDb *hubAddTracks(struct hubConnectStatus *hub, char *database);
+struct trackDb *hubAddTracks(struct hubConnectStatus *hub, char *database, boolean *foundFirstGenome, struct hash *trackDbNameHash);
 /* Load up stuff from data hub and append to list. The hubUrl points to
- * a trackDb.ra format file.  */
+ * a trackDb.ra format file. Only the first example of a genome gets to 
+ * populate groups, the others get a group for the trackHub.  A particular 
+ * trackDb is only read once even if referenced from more than one hub.  */
 
 char *hubConnectLoadHubs(struct cart *cart);
 /* load the track data hubs.  Set a static global to remember them */
 
 struct hubConnectStatus *hubConnectGetHubs();
 /* return the static global to the track data hubs */
 
 struct trackHub *hubConnectGetHub(char *hubUrl);
 /* Return the connected hub for hubUrl, or NULL if not found.  Do not free result. */
 
 struct trackHub *hubConnectGetHubForDb(char *db);
 /* Return the connected hub for db, or NULL if not found.  Do not free result. */
 
 struct trackDb *hubCollectTracks( char *database, struct grp **pGroupList);
 /* Generate trackDb structures for all the tracks in attached hubs.