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/trackHub.h src/hg/inc/trackHub.h
index b6d044b..ccd8082 100644
--- src/hg/inc/trackHub.h
+++ src/hg/inc/trackHub.h
@@ -71,34 +71,35 @@
     unsigned orderKey;   /* the orderKey for changing the order from the order in the file */
     char *chromAuthority;     /* what authority should be used to display sequence names */
     };
 
 void trackHubClose(struct trackHub **pHub);
 /* Close up and free resources from hub. */
 
 struct trackHub *trackHubOpen(char *url, char *hubName);
 /* Open up a track hub from url.  Reads and parses hub.ra and the genomesFile. 
  * The hubName is generally just the asciified ID number. */
 
 struct trackHubGenome *trackHubFindGenome(struct trackHub *hub, char *genomeName);
 /* Return trackHubGenome of given name associated with hub.  Return NULL if no
  * such genome. */
 
-struct trackDb *trackHubTracksForGenome(struct trackHub *hub, struct trackHubGenome *genome, struct dyString *incFiles);
+struct trackDb *trackHubTracksForGenome(struct trackHub *hub, struct trackHubGenome *genome, struct dyString *incFiles, boolean *foundFirstGenome);
 /* Get list of tracks associated with genome.  Check that it only is composed of legal
  * types.  Do a few other quick checks to catch errors early. If incFiles is not NULL,
- * put the list of included files in there. */
+ * put the list of included files in there.  Only the first example of a genome 
+ * gets to populate groups, the others get a group for the trackHub.  */
 
 void trackHubAddNamePrefix(char *hubName, struct trackDb *tdbList);
 /* For a hub named "xyz" add the prefix "hub_xyz_" to each track and parent field. 
  * This is useful to the genome browser which directly puts tracks into it's
  * user settings name space.... */
 
 void trackHubAddGroupName(char *hubName, struct trackDb *tdbList);
 /* Add group tag that references the hubs symbolic name. */
 
 char *trackHubSetting(struct trackHub *hub, char *name);
 /* Return setting if it exists, otherwise NULL. */
 
 char *trackHubRequiredSetting(struct trackHub *hub, char *name);
 /* Return named setting.  Abort with error message if not found. */