Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Suyu
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
many-archive
Suyu
Commits
499171ca
There was an error fetching the commit references. Please try again later.
Commit
499171ca
authored
9 years ago
by
Lectem
Browse files
Options
Downloads
Patches
Plain Diff
enforce config from hook
parent
85183a70
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitconfig
+0
-2
0 additions, 2 deletions
.gitconfig
hooks/pre-commit
+17
-16
17 additions, 16 deletions
hooks/pre-commit
with
17 additions
and
18 deletions
.gitconfig
deleted
100644 → 0
+
0
−
2
View file @
85183a70
[core]
whitespace
=
blank-at-eol,trailing-space,tab-in-indent
This diff is collapsed.
Click to expand it.
hooks/pre-commit
+
17
−
16
View file @
499171ca
#!/bin/sh
#check the config, in case the user really wants to allow tabs...
allowtabs
=
$(
git config hooks.allowtabs
)
if
[
"
$allowtabs
"
!=
"true"
]
&&
git diff
--cached
| egrep
'^\+.* '
then
cat
<<
END
;
Error: This commit would contain a tab, which is against this repo's policy.
# Enforce citra's whitespace policy
git config
--local
core.whitespace tab-in-indent,trailing-space
# If there are whitespace errors, print the offending file names and fail.
if
!
git diff
--cached
--check
;
then
cat
<<
END
;
Error: This commit would contain trailing spaces or tabs, which is against this repo's policy.
Please correct those issues before commiting. (Use 'git diff --check' for more details)
If you know what you are doing, you can try 'git commit --no-verify' to bypass the check
END
exit
1
exit
1
fi
# If there are whitespace errors, print the offending file names and fail.
if
# Use git built-in checks for trailing whitespaces
!
git diff
--check
--cached
then
cat
<<
END
;
Error: This commit would contain trailing spaces, which is against this repo's policy.
# Check for tabs, since tab-in-indent catches only those at the beginning of a line
if
git diff
--cached
| egrep
'^\+.* '
;
then
cat
<<
END
;
Error: This commit would contain a tab, which is against this repo's policy.
If you know what you are doing, you can try 'git commit --no-verify' to bypass the check.
END
exit
1
exit
1
fi
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment