Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
G
git-hooks-test
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shangbj
git-hooks-test
Commits
f63fc1d6
Commit
f63fc1d6
authored
Mar 15, 2020
by
shangbj
Browse files
Options
Browse Files
Download
Plain Diff
update
parents
f31ba8f4
5afa61db
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
app.js
app.js
+1
-0
commit-hook.js
build/commit-hook.js
+4
-4
No files found.
app.js
View file @
f63fc1d6
console
.
log
(
'app11.js11'
);
console
.
log
(
'app11.222'
);
console
.
log
(
'app11.222'
);
\ No newline at end of file
build/commit-hook.js
View file @
f63fc1d6
...
...
@@ -2,7 +2,7 @@ const fs = require('fs')
const
path
=
require
(
'path'
)
const
chalk
=
require
(
'chalk'
)
const
logSymbols
=
require
(
'log-symbols'
)
const
execSync
=
require
(
'child_process'
).
execSync
const
gitPath
=
path
.
join
(
process
.
cwd
(),
process
.
env
.
HUSKY_GIT_PARAMS
);
const
mergeMsgPath
=
path
.
join
(
gitPath
,
'../'
,
'MERGE_MSG'
)
...
...
@@ -12,8 +12,9 @@ function mergeCheck(){
const
mergeMsg
=
fs
.
readFileSync
(
mergeMsgPath
,
'utf-8'
);
let
curBranch
=
execSync
(
"git symbolic-ref HEAD | sed -e
\
's,.*/
\
(.*
\
),
\
1,
\
'"
,
{
encoding
:
'utf-8'
})
console
.
log
(
curBranch
)
console
.
log
(
mergeMsg
.
join
(
' '
).
pop
())
console
.
log
(
'curBranch'
,
curBranch
)
console
.
log
(
'mergeBranch'
,
mergeMsg
.
match
(
/
\"(
.*
?)\"
/g
))
process
.
exit
(
1
)
}
function
commitMsgCheck
(){
...
...
@@ -27,7 +28,6 @@ function commitMsgCheck(){
function
conflictCheck
()
{
console
.
log
(
logSymbols
.
info
,
chalk
.
blue
(
'开始冲突检测...'
))
const
execSync
=
require
(
'child_process'
).
execSync
// git 对所有冲突的地方都会生成下面这种格式的信息,所以写个检测冲突文件的正则
const
isConflictRegular
=
"^<<<<<<<
\\
s|^=======$|^>>>>>>>
\\
s"
...
...
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