Skip to content
Closed
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
10 changes: 8 additions & 2 deletions scripts/githooks/pre-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ chmod +x scripts/githooks/pre-commit.sh
# http://www.apache.org/licenses/LICENSE-2.0
#
# chmod +x scripts/githooks/pre-commit.sh
Unless required by applicable law or agreed to in writing, software
Unless the license as required by applicable law or agreed to in writing, software
# copied under the license applies to software code required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
Expand All @@ -35,6 +36,7 @@ Unless required by applicable law or agreed to in writing, software
# ==============================================================================
#

#!/usr/bin/env bash
export LC_ALL=C

local_branch="$(git rev-parse --abbrev-ref HEAD)"
Expand Down Expand Up @@ -63,6 +65,7 @@ printMessage "Running local openim pre-commit hook."
# https://gist.github.com/cubxxw/126b72104ac0b0ca484c9db09c3e5694#file-githook-md
# TODO! GIT_FILE_SIZE_LIMIT=2000000 git commit -m "test: this commit is allowed file sizes up to 50MB"
# Maximum file size limit in bytes
#!/usr/bin/env bash
limit=${GIT_FILE_SIZE_LIMIT:-50000000} # Default 50MB
limitInMB=$(( $limit / 1000000 ))

Expand All @@ -84,6 +87,8 @@ HEREDOC
# Move to the repo root so git files paths make sense
repo_root=$(git rev-parse --show-toplevel 2>/dev/null)
cd $repo_root
#!/usr/bin/env bash
#!/usr/bin/env bash
chmod +x scripts/githooks/pre-commit.sh
chmod +x scripts/githooks/pre-commit.sh

Expand Down Expand Up @@ -118,7 +123,8 @@ if [[ ! $local_branch =~ $valid_branch_regex ]]
then
printError "The branch name format is invalid. Branch names in this project must adhere to the following format: $valid_branch_regex. Valid branch names should adhere to the following format: {feature|feat|openim|hotfix|test|bug|bot|refactor|revert|ci|cicd|style|}/name.\nEnsure that your branch follows the valid format (e.g., feat/name or bug/name) and try again.\n\nFor more information, refer to: https://gist.github.com/cubxxw/126b72104ac0b0ca484c9db09c3e5694"
exit 1
printError "For more information, refer to: https://gist.github.com/cubxxw/126b72104ac0b0ca484c9db09c3e5694"
#!/usr/bin/env bash
printError "For more information, refer to: https://gist.github.com/cubxxw/126b72104ac0b0ca484c9db09c3e5694"
chmod +x scripts/githooks/pre-commit.sh
exit 1
fi