On Thu, Jan 9, 2014 at 2:20 PM, Jan Nijtmans <jan.nijtm...@gmail.com> wrote:

> 2014/1/9 Mark Janssen <mpc.jans...@gmail.com>:
> > The reflected information in the query is the info from before the ticket
> > update.
> > I suspect the ticket hook is fired before the actual ticket change
> > transaction is commited. Would it be possible to reverse this so that the
> > hook script will be executed after the ticket change has been commited?
>
> I'll have a look at that. In your test, how did the ticket change come in?
> Either with an xfer from another repository, or simply edited in the
> web-interface. This difference is important: The code path leading
> to the hook firing is different in those two situations.
>
> Thanks!
>       Jan Nijtmans
> _______________________________________________
> fossil-users mailing list
> fossil-users@lists.fossil-scm.org
> http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


I tested it with ticket changes from the web interface. Patch below fixes
the behavior for the webinterface, Not sure about tickets that are
transfered in.

Mark

Index: src/manifest.c
==================================================================
--- src/manifest.c
+++ src/manifest.c
@@ -1882,19 +1882,20 @@
       );
     }
   }
   if( p->type==CFTYPE_TICKET ){
     char *zTag;
-
+    manifest_crosslink_begin();
     zScript = xfer_ticket_code();
     zUuid = p->zTicketUuid;
     assert( manifest_crosslink_busy==1 );
     zTag = mprintf("tkt-%s", p->zTicketUuid);
     tag_insert(zTag, 1, 0, rid, p->rDate, rid);
     free(zTag);
     db_multi_exec("INSERT OR IGNORE INTO pending_tkt VALUES(%Q)",
                   p->zTicketUuid);
+    manifest_crosslink_end();
   }
   if( p->type==CFTYPE_ATTACHMENT ){
     db_multi_exec(
        "INSERT INTO attachment(attachid, mtime, src, target,"
                                         "filename, comment, user)"

Index: src/tkt.c
==================================================================
--- src/tkt.c
+++ src/tkt.c
@@ -534,14 +534,12 @@
     );
   }else{
     db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d);", rid);
     db_multi_exec("INSERT OR IGNORE INTO unclustered VALUES(%d);", rid);
   }
-  manifest_crosslink_begin();
   result = (manifest_crosslink(rid, pTicket, MC_PERMIT_HOOKS)==0);
   assert( blob_is_reset(pTicket) );
-  manifest_crosslink_end();
   return result;
 }

 /*
 ** Subscript command:   submit_ticket
_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to