Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
e20ad449
Commit
e20ad449
authored
Apr 29, 2017
by
Paul Eggert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow bypassing of some checks when merging
* build-aux/git-hooks/pre-commit: Don't check merged-in changes.
parent
bfc0f610
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
3 deletions
+19
-3
build-aux/git-hooks/pre-commit
build-aux/git-hooks/pre-commit
+19
-3
No files found.
build-aux/git-hooks/pre-commit
View file @
e20ad449
...
...
@@ -25,16 +25,32 @@ exec >&2
.
git-sh-setup
# When doing a two-way merge, ignore problems that came from the other
# side of the merge.
head
=
HEAD
if
test
-e
"
$GIT_DIR
"
/MERGE_HEAD
;
then
merge_heads
=
`
cat
"
$GIT_DIR
"
/MERGE_HEAD
`
||
exit
for
merge_head
in
$merge_heads
;
do
case
$head
in
HEAD
)
head
=
$merge_head
;;
# For multi-head merges, there's no easy way to ignore merged-in
# changes. But if you're doing multi-head merges, presumably
# you know how to handle any ensuing problems.
*
)
head
=
HEAD
;
break
;;
esac
done
fi
git_diff
=
'git diff --cached --name-only --diff-filter=A'
ok_chars
=
'\0+[=-=]./0-9A-Z_a-z'
nbadchars
=
`
$git_diff
-z
HEAD
|
tr
-d
"
$ok_chars
"
|
wc
-c
`
nbadchars
=
`
$git_diff
-z
$head
|
tr
-d
"
$ok_chars
"
|
wc
-c
`
if
test
"
$nbadchars
"
-ne
0
;
then
echo
"File name does not consist of -+./_ or ASCII letters or digits."
exit
1
fi
for
new_name
in
`
$git_diff
HEAD
`
;
do
for
new_name
in
`
$git_diff
$head
`
;
do
case
$new_name
in
-
*
|
*
/-
*
)
echo
"
$new_name
: File name component begins with '-'."
...
...
@@ -53,4 +69,4 @@ done
# tests so that trailing spaces are generated on the fly rather than
# being committed as source.
exec
git diff-index
--check
--cached
HEAD
--
exec
git diff-index
--check
--cached
$head
--
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