Well, now I'm in a situation which has been discussed here many times - I need 
to "unmake" certain file attachment from a repo, make it look like it had never 
been there.

I know it goes against the core values of Fossil philosophy and it's akin to 
replacing all fossilized trilobite remains in Paleozoic strata with Oreos so 
paleontologists would scratch their heads, but anyway.

I've built a little SQL to find all related artifact UUIDs for a given 
attachment and its history in a repo:

select a.attachid, datetime(a.mtime,'localtime') as created, a.comment
        , b.uuid as attach_artifact_uuid
        , b1.size as source_size, b1.uuid as source_artifact_uuid
        , e.comment
from attachment a
        left join blob b on b.rid = a.attachid
        left join blob b1 on b1.uuid = a.src
        left join event e on e.objid = a.attachid
where a.filename = 'big-bad-file.txt'
order by a.target, a.mtime;

Then I purge all found UUIDs starting with source_artifact_uuid and following 
with values of attach_artifact_uuid, like this:

fossil purge artifacts source_artifact_uuid ... attach_artifact_uuid

But when I re-execute that SQL again, it still returns non-empty data set 
(however, with NULLs for anything related to event or blob data). Investigating 
further I found that indeed all related blob and event data is gone, but 
attachment table still contains data-to-be-purged.

So I got the latest Fossil 2.6 sources and in purge.c file I see (in the 
comments for purge_artifact_list function):

** This routine does the following:
**
      ...
**    (6) Remove references to purged artifacts in the following tables:
**         (a) EVENT
      ...
**         (i) ATTACHMENT
      ...

So it looks like it should delete attachment data, but grepping for "attach" 
text in the file brings back the only match, which is the comment above.
The section of the function with numerous calls of db_multi_exec("DELETE FROM 
some_table WHERE some_condition", zTab) doesn't include anything for dealing 
with attachments.

A bug?

Not a showstopper for me as I can delete remaining attachment data manually, 
but I feel like I should report this.





_______________________________________________
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