git-rev-sync
Advanced tools
Comparing version 1.0.0 to 1.1.0
14
index.js
@@ -50,3 +50,15 @@ 'use strict'; | ||
var gitDir = getGitDir() | ||
var ref = fs.readFileSync(path.resolve(gitDir, 'refs', 'heads', b), 'utf8') | ||
var refsFilePath = path.resolve(gitDir, 'refs', 'heads', b) | ||
var ref; | ||
if (fs.existsSync(refsFilePath)) { | ||
ref = fs.readFileSync(refsFilePath, 'utf8') | ||
} else { | ||
// If there isn't an entry in /refs/heads for this branch, it may be that | ||
// the ref is stored in the packfile (.git/packed-refs). Fall back to | ||
// looking up the hash here. | ||
var refToFind = path.join('refs', 'heads', b) | ||
var packfileContents = fs.readFileSync(path.resolve(gitDir, 'packed-refs'), 'utf8') | ||
var packfileRegex = new RegExp('(.*) ' + refToFind) | ||
ref = packfileRegex.exec(packfileContents)[1] | ||
} | ||
return ref.trim() | ||
@@ -53,0 +65,0 @@ } |
{ | ||
"name": "git-rev-sync", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"author": "kurttheviking", | ||
@@ -15,3 +15,3 @@ "bugs": { | ||
{ | ||
"name": "jden", | ||
"name": "Jason Denizac", | ||
"email": "jason@denizac.org", | ||
@@ -44,4 +44,4 @@ "url": "http://jden.us" | ||
"dependencies": { | ||
"graceful-fs": "^3.0.5" | ||
"graceful-fs": "3.0.8" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6069
82
+ Addedgraceful-fs@3.0.8(transitive)
- Removedgraceful-fs@3.0.12(transitive)
- Removednatives@1.1.6(transitive)
Updatedgraceful-fs@3.0.8