1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Handle more git 2.1 differences

This commit is contained in:
Nick O'Leary 2018-02-07 13:47:09 +00:00
parent b3786700e6
commit 555b7df986
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 4 additions and 2 deletions

View File

@ -381,7 +381,7 @@ Project.prototype.getFileDiff = function(file,type) {
}
Project.prototype.getCommits = function(options) {
return gitTools.getCommits(this.path,options).catch(function(err) {
if (/ambiguous argument/.test(err.message) || /does not have any commits yet/.test(err.message)) {
if (/bad default revision/i.test(err.message) || /ambiguous argument/i.test(err.message) || /does not have any commits yet/i.test(err.message)) {
return {
count:0,
commits:[],
@ -733,6 +733,7 @@ Project.prototype.toJSON = function () {
function getCredentialsFilename(filename) {
filename = filename || "undefined";
// TODO: DRY - ./index.js
var ffDir = fspath.dirname(filename);
var ffExt = fspath.extname(filename);
@ -741,6 +742,7 @@ function getCredentialsFilename(filename) {
}
function getBackupFilename(filename) {
// TODO: DRY - ./index.js
filename = filename || "undefined";
var ffName = fspath.basename(filename);
var ffDir = fspath.dirname(filename);
return fspath.join(ffDir,"."+ffName+".backup");

View File

@ -204,7 +204,7 @@ function getStatus(localRepo) {
return runGitCommand(["status","--porcelain","-b"],localRepo).then(function(output) {
var lines = output.split("\n");
var unknownDirs = [];
var branchLineRE = /^## (?:No commits yet on )?(.+?)(?:$|\.\.\.(.+?)(?:$| \[(?:(?:ahead (\d+)(?:,\s*)?)?(?:behind (\d+))?|(gone))\]))/;
var branchLineRE = /^## (?:(?:No commits yet on )|(?:Initial commit on))?(.+?)(?:$|\.\.\.(.+?)(?:$| \[(?:(?:ahead (\d+)(?:,\s*)?)?(?:behind (\d+))?|(gone))\]))/;
lines.forEach(function(line) {
if (line==="") {
return;