Hooks setting appears as a checkbox in UI
(1) By blachniet on 2021-09-18 19:15:21 [source]
I reviewed the Hooks documentation. This suggests that you would generally interact with hooks (add, edit, delete) hooks through the fossil hook
commands.
Then, I stumbled upon a "hooks" setting in <repo-uri>/setup_settings
. The <repo-uri>/help?cmd=hooks
page states:
The "hooks" setting contains JSON that describes all defined hooks. The value is > an array of objects. Each object describes a single hook. Example:
{ "type": "after-receive", // type of hook "cmd": "command-to-run", // command to run "seq": 50 // run in this order }
Although that setting is intended to contain JSON content, it is shown in the UI as a checkbox. If you modify the setting in the UI, it overwrites the JSON generated by the fossil hook
commands.
Version information
$ fossil version
This is fossil version 2.16 [7aedd56758] 2021-07-02 12:46:01 UTC
Steps to reproduce
Start with no hooks:
$ fossil hook list
Add a new hook:
$ fossil hook add --command "go test ./..." --type before-commit $ fossil hook list 0: type = before-commit command = go test ./... sequence = 10
Observe that the setting is JSON.
$ fossil settings hooks hooks (local) [{"cmd":"go test ./...","type":"before-commit","seq":10}]
Navigate to the settings page in the UI, "check" the "hooks" setting and click "Apply Changes".
Review the hooks settings.
$ fossil settings hooks hooks (local) 1 $ fossil hook list 0: type = command = sequence = 0
Results
Modifying the hooks setting through the UI essentially breaks further use of the fossil hook
commands. You cannot add
/edit
/delete
any hooks. To get it back to a good state where you can use those commands, you must clear out the setting like so:
$ fossil settings hooks ''
I believe that we could solve this problem by showing the "hooks" setting as a text area in the UI.
Please let me know if there's any additional details I should provide.
(2) By Stephan Beal (stephan) on 2021-09-18 21:27:33 in reply to 1 [link] [source]
Please let me know if there's any additional details I should provide.
Thank you for the extremely detailed report! That is now fixed in the trunk. hooks
now appears over in the right-hand column with the other text-area settings.
(3) By blachniet on 2021-09-18 23:34:24 in reply to 2 [link] [source]
Wow, that was fast! I pulled and built trunk and the fix looks great. Thank you!