Skip to content

Commit

Permalink
feat: support git version <= 1.8.4 (#2)
Browse files Browse the repository at this point in the history
next-build-id now works with the default git version on CentOS 6 and 7
  • Loading branch information
shibukawa authored and nexdrew committed Apr 8, 2018
1 parent b10a867 commit 2724677
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ function determineBuildId (id, inputDir) {
if (id) return Promise.resolve(id)
return new Promise((resolve, reject) => {
const cp = require('child_process')
cp.execFile('git', ['-C', inputDir, 'rev-parse', 'HEAD'], (err, stdout, stderr) => {
cp.execFile('git', [`--git-dir=${inputDir}/.git`, `--work-tree=${inputDir}`, 'rev-parse', 'HEAD'], (err, stdout, stderr) => {
if (err) return reject(err)
if (stderr) return reject(String(stderr).trim())
if (stdout) return resolve(String(stdout).trim())
reject(`No output from command: git -C ${inputDir} rev-parse HEAD`)
reject(`No output from command: git --git-dir=${inputDir}/.git --work-tree=${inputDir} rev-parse HEAD`)
})
})
}
Expand Down

0 comments on commit 2724677

Please sign in to comment.