On 5/27/2016 3:58 PM, John P. Rouillard wrote:
Hi Richard:

Richard Hipp writes:
Just to be clear, I consider anything involving shunning to be
out-of-the-ordinary.

Perfectly reasonable.

On that note, does anybody have code for tcl hooks that can be used to
reject artifacts that have text that matches a particular pattern....

IMHO, that is capability is outside the core mission of fossil. One of the great selling points of fossil to new users is the low ceremony of fossil. One executable. A repo is a single file, that can even safely reside in the same folder as your checkout. And very little policy is enforced by fossil directly.

Aside, of course, from the big one: fossil preserves everything, and that history is immutable.

That said, there is a hook mechanism that can be used to check preconditions before executing a command. It might require some cleverness to use it for this purpose, however.

Hooks exist if fossil is compiled with the option, are written in TH1, can configured to make Tcl available to TH1, and are not extensively documented. One of the hooks is "command_hook" which is invoked for every fossil command. That name can raise an error (or call break or continue) to prevent the fossil command from executing.

Since the hook is called early, it knows the command name, its arguments, its flags, and not a lot else. Hence the need for cleverness since you would want to learn what files are going to be committed.

This hook has to run at the client, and before the commit is performed. So that won't prevent a user from bypassing it, or a misconfigured repostory from failing to call it, or if depending on Tcl, I'm sure there are more failure modes since Tcl is (usually, depending on configuration of fossil) loaded from the system at run time.

....
If you really wanted to commit a file that matched that pattern, you
added a string like: BYPASSPASSWORD to the commit message and the
check would be bypassed.

The fossil -no-th-hooks option will skip all hooks for that command. Depending on what else you do in a hook, that might be more than you wanted.

Is there some similar way to inspect the transferred artifacts and
file contents and roll back the commit?

Nope. And there can't be. Nothing is transferred until well after the whole collection of artifacts that make up the commit have been created and safely stowed in the local repository. There is no "roll back" from that.

--
Ross Berteig                               r...@cheshireeng.com
Cheshire Engineering Corp.           http://www.CheshireEng.com/
+1 626 303 1602
_______________________________________________
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