git-rev-sync
Advanced tools
Comparing version 1.12.0 to 2.0.0
29
index.js
@@ -20,3 +20,3 @@ 'use strict'; | ||
if (result.status !== 0) { | ||
throw new Error('[git-rev-sync] failed to execute command: ' + result.stderr); | ||
throw new Error('[git-rev-sync] failed to execute command: ' + result.stderr + '/' + result.error); | ||
} | ||
@@ -44,5 +44,5 @@ | ||
} | ||
var gitRepoPath = start.join(PATH_SEP); | ||
var testPath = gitRepoPath; | ||
var testPath = start.join(PATH_SEP); | ||
if (!testPath.length) { | ||
@@ -58,2 +58,6 @@ throw new Error('[git-rev-sync] no git repository found'); | ||
if (!path.isAbsolute(parentRepoPath)) { | ||
parentRepoPath = path.resolve(gitRepoPath, parentRepoPath); | ||
} | ||
if (fs.existsSync(parentRepoPath)) { | ||
@@ -63,9 +67,2 @@ return path.resolve(parentRepoPath); | ||
var submoduleName = parentRepoPath.split('/').pop(); | ||
var submodulePath = '../.git/modules/' + submoduleName; | ||
if (fs.existsSync(submodulePath)) { | ||
return path.resolve(submodulePath); | ||
} | ||
throw new Error('[git-rev-sync] could not find repository from path' + parentRepoPath); | ||
@@ -103,3 +100,6 @@ } | ||
var gitDir = _getGitDirectory(dir); | ||
var refsFilePath = path.resolve(gitDir, 'refs', 'heads', b); | ||
var gitRootDir = gitDir.indexOf('.git/worktrees/') > 0 ? | ||
gitDir.replace(/\.git\/worktrees\/.+$/, '.git') : | ||
gitDir; | ||
var refsFilePath = path.resolve(gitRootDir, 'refs', 'heads', b); | ||
var ref; | ||
@@ -146,3 +146,3 @@ | ||
function isDirty() { | ||
function hasUnstagedChanges() { | ||
var writeTree = _command('git', ['write-tree']); | ||
@@ -152,2 +152,6 @@ return _command('git', ['diff-index', writeTree, '--']).length > 0; | ||
function isDirty() { | ||
return _command('git', ['diff-index', 'HEAD', '--']).length > 0; | ||
} | ||
function isTagDirty() { | ||
@@ -186,2 +190,3 @@ try { | ||
date: date, | ||
hasUnstagedChanges: hasUnstagedChanges, | ||
isDirty: isDirty, | ||
@@ -188,0 +193,0 @@ isTagDirty: isTagDirty, |
{ | ||
"name": "git-rev-sync", | ||
"version": "1.12.0", | ||
"version": "2.0.0", | ||
"author": "kurttheviking", | ||
@@ -69,3 +69,3 @@ "bugs": { | ||
"escape-string-regexp": "1.0.5", | ||
"graceful-fs": "4.1.11", | ||
"graceful-fs": "4.1.15", | ||
"shelljs": "0.7.7" | ||
@@ -72,0 +72,0 @@ }, |
@@ -59,4 +59,8 @@ git-rev-sync [![Build Status](https://travis-ci.org/kurttheviking/git-rev-sync-js.svg?branch=master)](https://travis-ci.org/kurttheviking/git-rev-sync-js) | ||
#### `git.isDirty()` → <Boolean> | ||
#### `git.hasUnstagedChanges()` → <Boolean> | ||
returns true if there are unstaged changes; this method will fail if the `git` command is not found in `PATH` | ||
#### `git.isDrty()` → <Boolean> | ||
returns true if there are uncommitted changes; this method will fail if the `git` command is not found in `PATH` | ||
@@ -63,0 +67,0 @@ |
Sorry, the diff of this file is not supported yet
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
201
92
13327
9
+ Addedgraceful-fs@4.1.15(transitive)
- Removedgraceful-fs@4.1.11(transitive)
Updatedgraceful-fs@4.1.15