Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions docs/Contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,17 @@ Submitting an Issue
Contributing to gist
-----

After cloning the gist repository, run this script `./tools/setup.sh`.
After cloning the gist repository, run the script `./tools/setup.cmd`. This script will work on Windows, Linux, and Mac.

### Pre-commit Hook

The `./tools` directory contains a pre-commit hook that you should copy into `./git/hooks`. The setup.sh script mentioned above will do this for you.
The `./tools` directory contains a pre-commit hook that you should copy into `./git/hooks`. The setup.cmd script mentioned above will do this for you.

The pre-commit hook does a several things when you do a `git commit`:
- Prevent commits to the following branchs: develop, main, and master.
- Run the serializer before each commit. This converts files into a standard Turtle format in order to prevent noise in the diffs. As the comments in the file indicate, you should use the version of `rdf-toolkit.jar` in this directory, rather than another version that you may have on your local drive.
- Run a `sed` command to remove `skos` stubs that Protege may add to your files.
The pre-commit hook does several things when you run `git commit`:

- Prevents commits to the following branchs: develop, main, and master.
- Runs the serializer before each commit. This converts files into a standard Turtle format in order to remove noise in the diffs. As the comments in the file indicate, you should use the version of `rdf-toolkit.jar` in this directory, rather than another version that you may have elsewhere on your local drive.
- Runs a `sed` command to remove `skos` stubs that Protege may add to your files.

### Working Branch

Expand Down
24 changes: 10 additions & 14 deletions docs/release_notes/pr795.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
### Patch Updates

Issue [#794](https://github.com/semanticarts/gist/issues/794).

- Fix the serialize pre-commit hook
- Make sure the script starts in the root directory of the repository
- Correct the path to serializer
- Add file to the commit after the sed command
- Preserve file permissions during processing steps
- Add new "root" pre-commit hook
- Prevent commits to these branches: develop, main, master
- Then run the serializer pre-commit hook
- Add a setup.sh file to install the pre-commit hook
- Update the documentation to reflect these changes


- Modifications to pre-commit hook. Issues [#794](https://github.com/semanticarts/gist/issues/794) and [#795](https://github.com/semanticarts/gist/issues/795).
- Modified the serialize pre-commit hook so it:
- Makes sure the script starts in the root directory of the repository
- Adds file to the commit after the sed command
- Preserves file permissions during processing steps
- Added new "root" pre-commit hook which:
- Prevents commits to these branches: develop, main, master
- Then runs the serializer pre-commit hook
- Added a setup.cmd file to install the pre-commit hook into the .git/hooks directory. This script will work on Mac, Linux, and Windows.
- Updated user documentation to reflect these changes.
7 changes: 4 additions & 3 deletions tools/pre-commit
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env sh

# this is expected to be copied into the .git/hooks directory of the project
# This file should be copied into the .git/hooks directory of the project.

# Stops accidental commits to branches master, main, or develop.
BRANCH=`git rev-parse --abbrev-ref HEAD`
Expand All @@ -26,7 +26,8 @@ set +x

# echo "RESULT == ${rc}"
if [ ! ${rc} -eq 0 ] ; then
return 1
exit 1
fi

return 0
exit 0

33 changes: 33 additions & 0 deletions tools/setup.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
: # This script will do any configuration needed after cloning the gist git repository.
: # This is written to work with most linux shells and Windows command shell.
: # Be careful trying to modify it unless you understand how it really works.

: # Currently, this is very minimal:
: # - install a git pre-commit hook to enforce certain expectations prior to making a commit

:; if [ -z 0 ]; then
@echo off
goto :WINDOWS
fi

# Get root directory of this git repository
base_dir=$(git rev-parse --show-toplevel)

# print out commands so user can see what is being done
set -x

# copy pre-commit to the git hooks directory
cp "${base_dir}/tools/pre-commit" "${base_dir}/.git/hooks/"

# exit linux shell
exit


:WINDOWS
CHDIR "%~dp0"
IF EXIST "tools" chdir tools
IF EXIST "pre-commit" (
copy "pre-commit" ..\.git\hooks\
) ELSE (
echo Could not find the "pre-commit" file in %cd%.
)
15 changes: 0 additions & 15 deletions tools/setup.sh

This file was deleted.