Fossil SCM

Split sorting of the I-cards in the (ticket set) command into two passes, as submitTicketCmd() does, to address [forum:b90540b4d9|forum report 2026-10-30T09:14:24Z].

stephan 2026-11-13 15:16 UTC trunk
Commit 030455006f3bb831fc0255670521c76f3e1a01a9fdef9177f393e4c0349efef2
1 file changed +19 -12
+19 -12
--- src/tkt.c
+++ src/tkt.c
@@ -1834,33 +1834,40 @@
18341834
18351835
/* now add the needed artifacts to the repository */
18361836
blob_zero(&tktchng);
18371837
/* add the time to the ticket manifest */
18381838
blob_appendf(&tktchng, "D %s\n", zDate);
1839
- /* append defined elements */
1840
- for(i=0; i<nField; i++){
1839
+ /* append defined elements. J-cards must be in strictly ascending
1840
+ ** order by name, including any "+" prefix, so emit all "+name"
1841
+ ** (append) cards in a first pass and all plain (assignment) cards
1842
+ ** in a second pass, as is done in submitTicketCmd(). */
1843
+ for(i=0; i<nField*2; i++){
1844
+ const int iF = i % nField;
1845
+ const int bAppendPass = i < nField;
18411846
char *zValue = 0;
18421847
char *zPfx;
18431848
1844
- if( aField[i].zAppend && aField[i].zAppend[0] ){
1849
+ if( aField[iF].zAppend && aField[iF].zAppend[0] ){
1850
+ if( !bAppendPass ) continue;
18451851
zPfx = " +";
1846
- zValue = aField[i].zAppend;
1847
- aUsed[i] = JCARD_APPEND;
1848
- }else if( aField[i].zValue && aField[i].zValue[0] ){
1852
+ zValue = aField[iF].zAppend;
1853
+ aUsed[iF] = JCARD_APPEND;
1854
+ }else if( aField[iF].zValue && aField[iF].zValue[0] ){
1855
+ if( bAppendPass ) continue;
18491856
zPfx = " ";
1850
- zValue = aField[i].zValue;
1851
- aUsed[i] = JCARD_ASSIGN;
1857
+ zValue = aField[iF].zValue;
1858
+ aUsed[iF] = JCARD_ASSIGN;
18521859
}else{
18531860
continue;
18541861
}
1855
- if( memcmp(aField[i].zName, "private_", 8)==0 ){
1862
+ if( memcmp(aField[iF].zName, "private_", 8)==0 ){
18561863
zValue = db_conceal(zValue, strlen(zValue));
1857
- blob_appendf(&tktchng, "J%s%s %s\n", zPfx, aField[i].zName, zValue);
1858
- aUsed[i] = JCARD_PRIVATE;
1864
+ blob_appendf(&tktchng, "J%s%s %s\n", zPfx, aField[iF].zName, zValue);
1865
+ aUsed[iF] = JCARD_PRIVATE;
18591866
}else{
18601867
blob_appendf(&tktchng, "J%s%s %#F\n", zPfx,
1861
- aField[i].zName, strlen(zValue), zValue);
1868
+ aField[iF].zName, strlen(zValue), zValue);
18621869
}
18631870
}
18641871
blob_appendf(&tktchng, "K %s\n", zTktUuid);
18651872
blob_appendf(&tktchng, "U %F\n", zUser);
18661873
md5sum_blob(&tktchng, &cksum);
18671874
--- src/tkt.c
+++ src/tkt.c
@@ -1834,33 +1834,40 @@
1834
1835 /* now add the needed artifacts to the repository */
1836 blob_zero(&tktchng);
1837 /* add the time to the ticket manifest */
1838 blob_appendf(&tktchng, "D %s\n", zDate);
1839 /* append defined elements */
1840 for(i=0; i<nField; i++){
 
 
 
 
 
1841 char *zValue = 0;
1842 char *zPfx;
1843
1844 if( aField[i].zAppend && aField[i].zAppend[0] ){
 
1845 zPfx = " +";
1846 zValue = aField[i].zAppend;
1847 aUsed[i] = JCARD_APPEND;
1848 }else if( aField[i].zValue && aField[i].zValue[0] ){
 
1849 zPfx = " ";
1850 zValue = aField[i].zValue;
1851 aUsed[i] = JCARD_ASSIGN;
1852 }else{
1853 continue;
1854 }
1855 if( memcmp(aField[i].zName, "private_", 8)==0 ){
1856 zValue = db_conceal(zValue, strlen(zValue));
1857 blob_appendf(&tktchng, "J%s%s %s\n", zPfx, aField[i].zName, zValue);
1858 aUsed[i] = JCARD_PRIVATE;
1859 }else{
1860 blob_appendf(&tktchng, "J%s%s %#F\n", zPfx,
1861 aField[i].zName, strlen(zValue), zValue);
1862 }
1863 }
1864 blob_appendf(&tktchng, "K %s\n", zTktUuid);
1865 blob_appendf(&tktchng, "U %F\n", zUser);
1866 md5sum_blob(&tktchng, &cksum);
1867
--- src/tkt.c
+++ src/tkt.c
@@ -1834,33 +1834,40 @@
1834
1835 /* now add the needed artifacts to the repository */
1836 blob_zero(&tktchng);
1837 /* add the time to the ticket manifest */
1838 blob_appendf(&tktchng, "D %s\n", zDate);
1839 /* append defined elements. J-cards must be in strictly ascending
1840 ** order by name, including any "+" prefix, so emit all "+name"
1841 ** (append) cards in a first pass and all plain (assignment) cards
1842 ** in a second pass, as is done in submitTicketCmd(). */
1843 for(i=0; i<nField*2; i++){
1844 const int iF = i % nField;
1845 const int bAppendPass = i < nField;
1846 char *zValue = 0;
1847 char *zPfx;
1848
1849 if( aField[iF].zAppend && aField[iF].zAppend[0] ){
1850 if( !bAppendPass ) continue;
1851 zPfx = " +";
1852 zValue = aField[iF].zAppend;
1853 aUsed[iF] = JCARD_APPEND;
1854 }else if( aField[iF].zValue && aField[iF].zValue[0] ){
1855 if( bAppendPass ) continue;
1856 zPfx = " ";
1857 zValue = aField[iF].zValue;
1858 aUsed[iF] = JCARD_ASSIGN;
1859 }else{
1860 continue;
1861 }
1862 if( memcmp(aField[iF].zName, "private_", 8)==0 ){
1863 zValue = db_conceal(zValue, strlen(zValue));
1864 blob_appendf(&tktchng, "J%s%s %s\n", zPfx, aField[iF].zName, zValue);
1865 aUsed[iF] = JCARD_PRIVATE;
1866 }else{
1867 blob_appendf(&tktchng, "J%s%s %#F\n", zPfx,
1868 aField[iF].zName, strlen(zValue), zValue);
1869 }
1870 }
1871 blob_appendf(&tktchng, "K %s\n", zTktUuid);
1872 blob_appendf(&tktchng, "U %F\n", zUser);
1873 md5sum_blob(&tktchng, &cksum);
1874

Keyboard Shortcuts

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