stable

Clone or download

Read-only

Modify git:pre-receive-analyze command to accept the same input as a pre-receive hook

Modify the internals of the command so that it accepts multiple trios of the form <old_rev new_rev rev_name>. Akin to the way a git pre-receive hook behaves (See https://git-scm.com/docs/githooks#pre-receive for more details) New usage of the command: git:pre-receive-analyze <repository_id> <old_value new_value ref_name>... Example of valid calls: - tuleap git:pre-receive-analyze 1 c8ee0a8bcf3f185a272a04d6493456b3562f5050 e6ecbb16e4e9792fa8c5824204e1a58f2007dc31 refs/heads/master - tuleap git:pre-receive-analyze 1 c8ee0a8bcf3f185a272a04d6493456b3562f5050 e6ecbb16e4e9792fa8c5824204e1a58f2007dc31 refs/heads/master 0000000000000000000000000000000000000000 0066b8447a411086ecd19210dd3f5df818056f47 refs/heads/tuleap-new-branch This also modifies the structure of the JSON that is provided to the WASM module, here's the new structure: { "updated_references": { "refs\/heads\/master": { "oldrev": "c8ee0a8bcf3f185a272a04d6493456b3562f5050", "newrev": "e6ecbb16e4e9792fa8c5824204e1a58f2007dc31" }, "refs\/heads\/tuleap-new-branch": { "oldrev": "0000000000000000000000000000000000000000", "newrev": "0066b8447a411086ecd19210dd3f5df818056f47" } } } The provided WASM module in src/additional-packages/pre-receive-hook-example/ will now reject a push with a meaningful error message, if one of the ref name does not start with 'refs\/heads\/tuleap-'. To test: - tuleap config-set feature_flag_enable_pre_receive_analyze_command 1 (set the feature flag) - tuleap git:pre-receive-analyze <repository_id> <old_value new_value ref_name>... (launch the command with valid parameters) Part of story #28845 have an hidden command executing custom command to determine if the reference should have been rejected Change-Id: Ibcf91eebd37124ded17383894bdd5edcdbbb3a52

Modified Files

Name
M plugins/git/include/Hook/PreReceive/PreReceiveAnalyzeAction.php +9 −11 Go to diff View file
M plugins/git/include/Hook/PreReceive/PreReceiveAnalyzeCommand.php +11 −5 Go to diff View file
A plugins/git/include/Hook/PreReceive/PreReceiveHookData.php +39 −0 Go to diff View file
A plugins/git/include/Hook/PreReceive/PreReceiveHookUpdatedReference.php +31 −0 Go to diff View file
M plugins/git/tests/unit/Hook/PreReceive/PreReceiveAnalyzeActionTest.php +3 −59 Go to diff View file
M src/additional-packages/pre-receive-hook-example/src/main.rs +26 −9 Go to diff View file
M src/additional-packages/pre-receive-hook-example/src/wire.rs +10 −4 Go to diff View file
M src/additional-packages/wasmtime-wrapper-lib/src/lib.rs +21 −3 Go to diff View file