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
9 changes: 4 additions & 5 deletions scripts/githooks/pre-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ chmod +x scripts/githooks/pre-commit.sh
#

LC_ALL=C

local_branch="$(git rev-parse --abbrev-ref HEAD)"
valid_branch_regex="^(main|master|develop|release(-[a-zA-Z0-9._-]+)?)$|(feature|feat|openim|hotfix|test|bug|bot|refactor|revert|ci|cicd|style|)\/[a-z0-9._-]+$|^HEAD$"

Expand Down Expand Up @@ -63,7 +62,7 @@ printMessage "Running local openim pre-commit hook."
# TODO! GIT_FILE_SIZE_LIMIT=50000000 git commit -m "test: this commit is allowed file sizes up to 50MB"
# Maximum file size limit in bytes
limit=${GIT_FILE_SIZE_LIMIT:-2000000} # Default 2MB
limitInMB=$(( $limit / 1000000 ))
limitInMB=$(( $limit / 1000000 )) # This will correctly calculate the file size limit in megabytes

function file_too_large(){
filename=$file
Expand All @@ -75,9 +74,9 @@ file_too_large $filesize $filename # Moved the function call outside the HEREDOC

file_too_large $filesize $filename

File $filename is $filesize MB, which is larger than github's maximum
file size (20 MB). We will not be able to push this file to GitHub.
The maximum file size allowed is 2MB.
File $filename is $filesize MB, which is larger than the maximum file size allowed ($limitInMB MB).
We will not be able to push this file to GitHub.
The maximum file size allowed is $limitInMB MB.
Commit aborted

HEREDOC
Expand Down