Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
overcommit/template-dir/hooks/commit-msg at master · githubFeature/overcommit · GitHub
Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
githubFeature
/
overcommit
Public
forked from
sds/overcommit
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Files
Expand file tree
master
Breadcrumbs
overcommit
/
template-dir
/
hooks
/
commit-msg
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
executable file
·
115 lines (100 loc) · 3.68 KB
master
Breadcrumbs
overcommit
/
template-dir
/
hooks
/
commit-msg
Copy path
Top
File metadata and controls
Code
Blame
executable file
·
115 lines (100 loc) · 3.68 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/usr/bin/env ruby
# Entrypoint for Overcommit hook integration. Installing Overcommit will result
# in all of your git hooks being copied from this file, allowing the framework
# to manage your hooks for you.
# Prevent a Ruby stack trace from appearing when we interrupt the hook.
# Note that this will be overridden when Overcommit is loaded, since the
# InterruptHandler will redefine the trap at that time.
Signal
.
trap
(
'INT'
)
do
puts
'Hook run interrupted'
exit
130
end
# Allow hooks to be disabled via environment variable so git commands can be run
# in scripts without Overcommit running hooks
if
ENV
[
'OVERCOMMIT_DISABLE'
]
.
to_i
!=
0
||
ENV
[
'OVERCOMMIT_DISABLED'
]
.
to_i
!=
0
exit
end
hook_type
=
File
.
basename
(
$0
)
if
hook_type
==
'overcommit-hook'
puts
"Don't run `overcommit-hook` directly; it is intended to be symlinked "
\
"by each hook in a repository's .git/hooks directory."
exit
64
# EX_USAGE
end
# Check if Overcommit should invoke a Bundler context for loading gems
require
'yaml'
# rubocop:disable Style/RescueModifier
if
gemfile
=
YAML
.
load_file
(
'.overcommit.yml'
)
[
'gemfile'
]
rescue
nil
ENV
[
'BUNDLE_GEMFILE'
]
=
gemfile
require
'bundler'
begin
Bundler
.
setup
rescue
Bundler
::
BundlerError
=>
ex
puts
"Problem loading '
#{
gemfile
}
':
#{
ex
.
message
}
"
puts
"Try running:
\n
bundle install --gemfile=
#{
gemfile
}
"
if
ex
.
is_a?
(
Bundler
::
GemNotFound
)
exit
78
# EX_CONFIG
end
end
# rubocop:enable Style/RescueModifier
begin
require
'overcommit'
rescue
LoadError
if
gemfile
puts
'You have specified the `gemfile` option in your Overcommit '
\
'configuration but have not added the `overcommit` gem to '
\
"
#{
gemfile
}
."
else
puts
'This repository contains hooks installed by Overcommit, but the '
\
"`overcommit` gem is not installed.
\n
"
\
'Install it with `gem install overcommit`.'
end
exit
64
# EX_USAGE
end
begin
logger
=
Overcommit
::
Logger
.
new
(
STDOUT
)
Overcommit
::
Utils
.
log
=
logger
# Ensure master hook is up-to-date
installer
=
Overcommit
::
Installer
.
new
(
logger
)
if
installer
.
run
(
Overcommit
::
Utils
.
repo_root
,
action
:
:update
)
exec
(
$0
,
*
ARGV
)
# Execute the updated hook with all original arguments
end
config
=
Overcommit
::
ConfigurationLoader
.
new
(
logger
)
.
load_repo_config
context
=
Overcommit
::
HookContext
.
create
(
hook_type
,
config
,
ARGV
,
STDIN
)
config
.
apply_environment!
(
context
,
ENV
)
printer
=
Overcommit
::
Printer
.
new
(
config
,
logger
,
context
)
runner
=
Overcommit
::
HookRunner
.
new
(
config
,
logger
,
context
,
printer
)
status
=
runner
.
run
exit
(
status
?
0
:
65
)
# 65 = EX_DATAERR
rescue
Overcommit
::
Exceptions
::
ConfigurationError
=>
error
puts
error
exit
78
# EX_CONFIG
rescue
Overcommit
::
Exceptions
::
HookContextLoadError
=>
error
puts
error
puts
'Are you running an old version of Overcommit?'
exit
69
# EX_UNAVAILABLE
rescue
Overcommit
::
Exceptions
::
HookLoadError
,
Overcommit
::
Exceptions
::
InvalidHookDefinition
=>
error
puts
error
.
message
puts
error
.
backtrace
exit
78
# EX_CONFIG
rescue
Overcommit
::
Exceptions
::
HookSetupFailed
,
Overcommit
::
Exceptions
::
HookCleanupFailed
=>
error
puts
error
.
message
exit
74
# EX_IOERR
rescue
Overcommit
::
Exceptions
::
HookCancelled
puts
'You cancelled the hook run'
exit
130
# Ctrl-C cancel
rescue
Overcommit
::
Exceptions
::
InvalidGitRepo
=>
error
puts
error
exit
64
# EX_USAGE
rescue
Overcommit
::
Exceptions
::
ConfigurationSignatureChanged
=>
error
puts
error
puts
"For more information, see
#{
Overcommit
::
REPO_URL
}
#security"
exit
1
rescue
Overcommit
::
Exceptions
::
InvalidHookSignature
exit
1
rescue
StandardError
=>
error
puts
error
.
message
puts
error
.
backtrace
puts
"Report this bug at
#{
Overcommit
::
BUG_REPORT_URL
}
"
exit
70
# EX_SOFTWARE
end
You can’t perform that action at this time.