Fossil SCM

Quote the "tags" key in the JSON written by "fossil whatis --json" and the whatis() SQL function, so that the output is valid JSON for an artifact that has tags.

dmestas 2026-11-22 11:47 UTC small-fixes
Commit eb35f976d30dabfb6fbfc43944b79b12aea7ba6e9883a019a33cef2b45c7c6fd
1 file changed +1 -1
+1 -1
--- src/name.c
+++ src/name.c
@@ -1246,11 +1246,11 @@
12461246
);
12471247
cnt = 0;
12481248
while( db_step(&q)==SQLITE_ROW ){
12491249
const char *zTag = (const char*)db_column_text(&q,0);
12501250
if( pOut ){
1251
- const char *zSep = cnt==0 ? ",tags:[" : ",";
1251
+ const char *zSep = cnt==0 ? ",\"tags\":[" : ",";
12521252
sqlite3_str_appendf(pOut, "%s%J", zSep, zTag);
12531253
}else{
12541254
const char *zPrefix = cnt ? ", " : "tags: ";
12551255
fossil_print("%s%s", zPrefix, db_column_text(&q,0));
12561256
}
12571257
--- src/name.c
+++ src/name.c
@@ -1246,11 +1246,11 @@
1246 );
1247 cnt = 0;
1248 while( db_step(&q)==SQLITE_ROW ){
1249 const char *zTag = (const char*)db_column_text(&q,0);
1250 if( pOut ){
1251 const char *zSep = cnt==0 ? ",tags:[" : ",";
1252 sqlite3_str_appendf(pOut, "%s%J", zSep, zTag);
1253 }else{
1254 const char *zPrefix = cnt ? ", " : "tags: ";
1255 fossil_print("%s%s", zPrefix, db_column_text(&q,0));
1256 }
1257
--- src/name.c
+++ src/name.c
@@ -1246,11 +1246,11 @@
1246 );
1247 cnt = 0;
1248 while( db_step(&q)==SQLITE_ROW ){
1249 const char *zTag = (const char*)db_column_text(&q,0);
1250 if( pOut ){
1251 const char *zSep = cnt==0 ? ",\"tags\":[" : ",";
1252 sqlite3_str_appendf(pOut, "%s%J", zSep, zTag);
1253 }else{
1254 const char *zPrefix = cnt ? ", " : "tags: ";
1255 fossil_print("%s%s", zPrefix, db_column_text(&q,0));
1256 }
1257

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button