Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Aron Helser
VTK
Commits
2b3a3cd7
Commit
2b3a3cd7
authored
Apr 20, 2010
by
Brad King
Browse files
pre-commit: Validate user.name and user.email
parent
8f96d675
Changes
1
Hide whitespace changes
Inline
Side-by-side
pre-commit
View file @
2b3a3cd7
...
...
@@ -12,15 +12,25 @@ die() {
#-----------------------------------------------------------------------------
# Check for committer identity.
git config
--get
user.name
>
/dev/null
&&
git config
--get
user.email
>
/dev/null
||
die
'Identity not configured! Use the commands
advice
=
'
Use the commands
git config --global user.name '
\'
'Your Name'
\'
'
git config --global user.email '
\'
'you@yourdomain.com'
\'
'
to introduce yourself to Git before committing.'
# Ensure name and email are available.
git config
--get
user.name
>
/dev/null
&&
git config
--get
user.email
>
/dev/null
||
die
'Identity not configured!'
"
$advice
"
# Validate the name and email.
git config
--get
user.name |
grep
' '
>
/dev/null
||
die
'Set user.name to your Real Name (with a space), not a userid.'
"
$advice
"
git config
--get
user.email |
grep
'^[^@]*@[^@]*$'
>
/dev/null
||
die
'Set user.email to an email address (userid@validdomain.com).'
"
$advice
"
#-----------------------------------------------------------------------------
# Check content that will be added by this commit.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment