1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/cmd
Delyan Angelov 1978176c22
tools: add an utility cmd/tools/git_pre_commit_hook.vsh script
That script can be used to ensure that all commited V files are vfmt-ed,
i.e. it will run `v fmt -w ` on them before commiting them.

To use the script in your V project, you need to be in the main folder
of your project, then do the equivalent of:
```sh
cp /PATH/TO_YOUR/V/cmd/tools/git_pre_commit_hook.vsh .git/hooks/pre-commit
chmod 755 .git/hooks/pre-commit
```

Note: you can use this command:
`git config --bool --add hooks.stopCommitOfNonVfmtedVFiles true`
... to make it just *prevent* the commiting of unformatted .v files,
i.e. stop the commiting, if they are not, but *without modifying them*
automatically (you will then need to run `v fmt -w` on them manually).

Note 2: Git supports the option `--no-verify`, to temporarily disable all hooks.
2022-11-13 21:22:46 +02:00
..
tools tools: add an utility cmd/tools/git_pre_commit_hook.vsh script 2022-11-13 21:22:46 +02:00
v doc: document the -no-bounds-checking option in v help build 2022-10-30 15:05:02 +02:00