1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
Commit Graph

3 Commits

Author SHA1 Message Date
yuyi
017ace6ea7
vfmt: change all '$expr' to '${expr}' (#16428) 2022-11-15 16:53:13 +03:00
Delyan Angelov
eb11b0149d
tools: fix git_pre_commit_hook.vsh on windows 2022-11-13 21:57:10 +02:00
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