Fossil SCM

In manifest_crosslink(), use REPLACE INTO for the attachment table, as for event, so that crosslinking an attachment artifact a second time does not fail. A push of an attachment the receiving repository already held ended with a UNIQUE constraint error.

dmestas 2026-11-18 22:41 UTC small-fixes
Commit 087d1d46fd2fa2a8f3f3606d59e5d96669cf758503ea6ca69d7ccfcce47f480d
1 file changed +1 -1
+1 -1
--- src/manifest.c
+++ src/manifest.c
@@ -2633,11 +2633,11 @@
26332633
if( p->type==CFTYPE_ATTACHMENT ){
26342634
char *zComment = 0;
26352635
const char isAdd = (p->zAttachSrc && p->zAttachSrc[0]) ? 1 : 0;
26362636
char attachToType = 0;
26372637
db_multi_exec(
2638
- "INSERT INTO attachment(attachid, mtime, src, target,"
2638
+ "REPLACE INTO attachment(attachid, mtime, src, target,"
26392639
"filename, comment, user)"
26402640
"VALUES(%d,%.17g,%Q,%Q,%Q,%Q,%Q);",
26412641
rid, p->rDate, p->zAttachSrc, p->zAttachTarget, p->zAttachName,
26422642
(p->zComment ? p->zComment : ""), p->zUser
26432643
);
26442644
--- src/manifest.c
+++ src/manifest.c
@@ -2633,11 +2633,11 @@
2633 if( p->type==CFTYPE_ATTACHMENT ){
2634 char *zComment = 0;
2635 const char isAdd = (p->zAttachSrc && p->zAttachSrc[0]) ? 1 : 0;
2636 char attachToType = 0;
2637 db_multi_exec(
2638 "INSERT INTO attachment(attachid, mtime, src, target,"
2639 "filename, comment, user)"
2640 "VALUES(%d,%.17g,%Q,%Q,%Q,%Q,%Q);",
2641 rid, p->rDate, p->zAttachSrc, p->zAttachTarget, p->zAttachName,
2642 (p->zComment ? p->zComment : ""), p->zUser
2643 );
2644
--- src/manifest.c
+++ src/manifest.c
@@ -2633,11 +2633,11 @@
2633 if( p->type==CFTYPE_ATTACHMENT ){
2634 char *zComment = 0;
2635 const char isAdd = (p->zAttachSrc && p->zAttachSrc[0]) ? 1 : 0;
2636 char attachToType = 0;
2637 db_multi_exec(
2638 "REPLACE INTO attachment(attachid, mtime, src, target,"
2639 "filename, comment, user)"
2640 "VALUES(%d,%.17g,%Q,%Q,%Q,%Q,%Q);",
2641 rid, p->rDate, p->zAttachSrc, p->zAttachTarget, p->zAttachName,
2642 (p->zComment ? p->zComment : ""), p->zUser
2643 );
2644

Keyboard Shortcuts

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