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
e79f904f
Commit
e79f904f
authored
Mar 15, 2020
by
shangbj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
5a3e16b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
17 deletions
+18
-17
push.js
build/push.js
+18
-17
No files found.
build/push.js
View file @
e79f904f
...
...
@@ -7,28 +7,29 @@ const fs = require('fs')
// const path = require('path')
// const shell = require('shelljs')
// const exec = require('child_process').exec
// var commitMsg = fs.readFileSync(path.resolve(__dirname, 'git-push.sh
'), 'utf-8');
var
commitMsg
=
fs
.
readFileSync
(
path
.
resolve
(
__dirname
,
'../.git/refs/heads
'
),
'utf-8'
);
console
.
log
(
commitMsg
)
// exec('git diff --name-only', function(err, stdout,stderr){
// console.log('err',err)
// console.log('stdout',stdout)
// console.log('stderr',stderr)
// })
let
stream
=
''
if
(
process
.
platform
===
'win32'
)
{
// husky不支持配置.git/hooks/xx 中的sh脚本
// 需要手动加入 exec < /dev/tty 开启交互
stream
=
process
.
stdin
;
}
else
{
stream
=
fs
.
createReadStream
(
'/dev/tty'
);
}
//
let stream = ''
//
if (process.platform === 'win32') {
//
// husky不支持配置.git/hooks/xx 中的sh脚本
//
// 需要手动加入 exec < /dev/tty 开启交互
//
stream = process.stdin;
//
} else {
//
stream = fs.createReadStream('/dev/tty');
//
}
stream
.
setEncoding
(
'utf-8'
);
stream
.
on
(
'error'
,
()
=>
{
// do something...
});
stream
.
on
(
'data'
,
(
data
)
=>
{
// do something...
comsole
.
log
(
data
)
});
\ No newline at end of file
// stream.setEncoding('utf-8');
// stream.on('error', () => {
// // do something...
// });
// stream.on('data', (data) => {
// // do something...
// console.log(data)
// });
\ No newline at end of file
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