Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dugite-extra

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dugite-extra - npm Package Compare versions

Comparing version 0.0.1-alpha.15 to 0.0.1-alpha.16

14

lib/command/status.js

@@ -108,3 +108,3 @@ "use strict";

return __awaiter(this, void 0, void 0, function () {
var result, files, currentBranch, currentUpstreamBranch, currentTip, branchAheadBehind, _loop_1, _a, _b, entry, workingDirectory, e_1, _c;
var result, files, existingFiles, currentBranch, currentUpstreamBranch, currentTip, branchAheadBehind, _loop_1, _a, _b, entry, workingDirectory, e_1, _c;
return __generator(this, function (_d) {

@@ -116,2 +116,3 @@ switch (_d.label) {

files = new Array();
existingFiles = new Set();
currentBranch = undefined;

@@ -138,5 +139,7 @@ currentUpstreamBranch = undefined;

// remove it if found
var existingEntry = files.findIndex(function (p) { return p.path === entry.path; });
if (existingEntry > -1) {
files.splice(existingEntry, 1);
if (existingFiles.has(entry.path)) {
var existingEntry = files.findIndex(function (p) { return p.path === entry.path; });
if (existingEntry > -1) {
files.splice(existingEntry, 1);
}
}

@@ -151,5 +154,7 @@ }

files.push(new status_1.WorkingDirectoryFileChange(entry.path, summary, selection, entry.oldPath, true));
existingFiles.add(entry.path);
}
if (changeInWorkingTree) {
files.push(new status_1.WorkingDirectoryFileChange(entry.path, summary, selection, entry.oldPath, false));
existingFiles.add(entry.path);
}

@@ -159,2 +164,3 @@ // Must be untracked

files.push(new status_1.WorkingDirectoryFileChange(entry.path, summary, selection, entry.oldPath, false));
existingFiles.add(entry.path);
}

@@ -161,0 +167,0 @@ }

@@ -41,2 +41,4 @@ "use strict";

var path = require("path");
var os = require("os");
var fs = require("fs-extra");
var chai_1 = require("chai");

@@ -46,9 +48,35 @@ var status_1 = require("./status");

var test_helper_1 = require("./test-helper");
var clone_1 = require("./clone");
var track = temp.track();
describe('status', function () { return __awaiter(_this, void 0, void 0, function () {
var _this = this;
var repositoryWithChanges;
return __generator(this, function (_a) {
repositoryWithChanges = path.join(os.homedir(), '.git');
before(function () { return __awaiter(_this, void 0, void 0, function () {
var tmpPath;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (fs.existsSync(repositoryWithChanges)) {
fs.removeSync(repositoryWithChanges);
}
return [4 /*yield*/, clone_1.clone('https://github.com/eclipse/xtext-core.git', repositoryWithChanges)];
case 1:
_a.sent();
tmpPath = path.join(repositoryWithChanges, 'tmp');
fs.mkdirpSync(tmpPath);
fs.readdirSync(repositoryWithChanges).forEach(function (fileName) {
if (fileName.startsWith('org.eclipse.xtext')) {
fs.moveSync(path.join(repositoryWithChanges, fileName), path.join(tmpPath, fileName));
}
});
return [2 /*return*/];
}
});
}); });
after(function () { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
track.cleanupSync();
fs.removeSync(repositoryWithChanges);
return [2 /*return*/];

@@ -147,2 +175,18 @@ });

}); });
it('in repository with changes', function () {
return __awaiter(this, void 0, void 0, function () {
var status;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this.timeout(1000);
return [4 /*yield*/, status_1.getStatus(repositoryWithChanges)];
case 1:
status = _a.sent();
chai_1.expect(status.workingDirectory.files.length > 10000);
return [2 /*return*/];
}
});
});
});
return [2 /*return*/];

@@ -149,0 +193,0 @@ });

{
"name": "dugite-extra",
"version": "0.0.1-alpha.15",
"version": "0.0.1-alpha.16",
"description": "High-level Git commands for dugite.",

@@ -5,0 +5,0 @@ "main": "lib/index",

import * as temp from 'temp';
import * as path from 'path';
import * as os from 'os';
import * as fs from 'fs-extra';
import { expect } from 'chai';

@@ -7,2 +9,3 @@ import { getStatus } from './status';

import { createTestRepository, add, remove, modify } from './test-helper';
import { clone } from './clone';

@@ -14,4 +17,21 @@

const repositoryWithChanges = path.join(os.homedir(), '.git');
before(async () => {
if (fs.existsSync(repositoryWithChanges)) {
fs.removeSync(repositoryWithChanges);
}
await clone('https://github.com/eclipse/xtext-core.git', repositoryWithChanges);
const tmpPath = path.join(repositoryWithChanges, 'tmp');
fs.mkdirpSync(tmpPath);
fs.readdirSync(repositoryWithChanges).forEach(fileName => {
if (fileName.startsWith('org.eclipse.xtext')) {
fs.moveSync(path.join(repositoryWithChanges, fileName), path.join(tmpPath, fileName));
}
});
})
after(async () => {
track.cleanupSync();
fs.removeSync(repositoryWithChanges);
});

@@ -68,2 +88,8 @@

it('in repository with changes', async function () {
this.timeout(1000);
const status = await getStatus(repositoryWithChanges);
expect(status.workingDirectory.files.length > 10000);
});
});

@@ -52,2 +52,4 @@ import { git } from '../core/git';

const files = new Array<WorkingDirectoryFileChange>();
// https://github.com/theia-ide/dugite-extra/issues/10
const existingFiles = new Set<string>();

@@ -80,5 +82,7 @@ let currentBranch: string | undefined = undefined;

// remove it if found
const existingEntry = files.findIndex(p => p.path === entry.path);
if (existingEntry > -1) {
files.splice(existingEntry, 1);
if (existingFiles.has(entry.path)) {
const existingEntry = files.findIndex(p => p.path === entry.path);
if (existingEntry > -1) {
files.splice(existingEntry, 1);
}
}

@@ -105,2 +109,3 @@ }

);
existingFiles.add(entry.path);
}

@@ -118,2 +123,3 @@

);
existingFiles.add(entry.path);
}

@@ -132,2 +138,3 @@

);
existingFiles.add(entry.path);
}

@@ -134,0 +141,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc