Skip to content

Commit ad670ac

Browse files
committed
Add git pre-push examples in README
1 parent 90f4e30 commit ad670ac

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ pip3 install -r requirements.txt
164164

165165
The `pre-push` git hook should be installed to avoid **project-specific** validation functions (which should be defined and stored under `esdlvalidator/validation/functions/projects/`) from being pushed to an open GitHub repository.
166166

167-
This does not affect when pushing changes to the internal gitlab repository (both project-specific functions and generic functions can be pushed to remotes).
167+
This does not affect when pushing changes to the internal gitlab repository (both project-specific or generic functions can be pushed to remotes).
168168

169169
At the project root, run the command in a bash terminal to set up git hooks.
170170

@@ -180,6 +180,24 @@ Setting up Git hooks...
180180
```
181181

182182

183+
#### Examples
184+
185+
When pushing to the internal gitlab repository with `git push`, you would see message like below and then proceed.
186+
187+
```
188+
Pre-push hook triggered for remote https://ci.tno.nl/gitlab/warmingup/chess-preprocessor.git
189+
...
190+
```
191+
192+
When pushing to the open GitHub repository with `git push`, and if there are any files and changes made under `esdlvalidator/validation/functions/projects/`, the push action is aborted with the following message.
193+
194+
```
195+
Pre-push hook triggered for remote https://github.com/ESDLMapEditorESSIM/ESDLValidator.git
196+
Pushing to GitHub. Checking files under esdlvalidator/validation/functions/projects/ ...
197+
❌ Push to GitHub rejected! The following files are in the blocked 'esdlvalidator/validation/functions/projects/' directory:
198+
esdlvalidator/validation/functions/projects/nwn/test.py
199+
➡️ These files must not be pushed to GitHub. Push to GitLab is allowed.
200+
```
183201

184202
### Testing
185203

0 commit comments

Comments
 (0)