94f6c02614e12c0c96d63ff59f193e8231a203a9
chmalee
  Mon Nov 28 13:58:04 2022 -0800
hgTrackDb should change the tdb->settingsHash when it does label substitution, refs #30324

diff --git src/hg/makeDb/hgTrackDb/hgTrackDb.c src/hg/makeDb/hgTrackDb/hgTrackDb.c
index 88afad5..f9cc94a 100644
--- src/hg/makeDb/hgTrackDb/hgTrackDb.c
+++ src/hg/makeDb/hgTrackDb/hgTrackDb.c
@@ -867,30 +867,37 @@
 
 /* Write to tab-separated file; hold off on html, since it must be encoded */
     {
     verbose(2, "Starting write of tabs to %s\n", tab);
     FILE *f = mustOpen(tab, "w");
     for (td = tdbList; td != NULL; td = td->next)
         {
         hVarSubstTrackDb(td, database);
         char *hold = td->html;
         td->html = "";
 	subChar(td->type, '\t', ' ');	/* Tabs confuse things. */
 	subChar(td->shortLabel, '\t', ' ');	/* Tabs confuse things. */
 	subChar(td->longLabel, '\t', ' ');	/* Tabs confuse things. */
 	trackDbTabOut(td, f);
         td->html = hold;
+        // be sure to change the settings hash with the updated substituted settings
+        if (td->settingsHash)
+            {
+            hashReplace(td->settingsHash, "shortLabel", cloneString(td->shortLabel));
+            hashReplace(td->settingsHash, "longLabel", cloneString(td->longLabel));
+            hashReplace(td->settingsHash, "html", cloneString(td->html));
+            }
         }
     carefulClose(&f);
     verbose(2, "Wrote tab representation to %s\n", tab);
     }
 
 /* Update database */
     {
     char *create, *end;
     char query[2048];
     struct sqlConnection *conn = sqlConnect(database);
 
     /* Load in table definition. */
     readInGulp(sqlFile, &create, NULL);
     create = trimSpaces(create);
     create = substituteTrackName(create, trackDbName);