Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function gitTweet (link, op, fname, callback) {
var repository = git.open(__dirname) //Open the repository
var statusObj = _.pairs(repository.getStatus()); // Get array of [file, status] in the repository.
tweet(link, fname, repository.getStatus()[fname], op)
child_process.exec('git add ' + fname, function (err, stdout, stderr) {
callback()
})
}
image.writeFile(filename, function (err) {
if (err) {
return deferred.reject('error saving screenshot: ' + err);
}
var status = git.open('.').getStatus(filename.substring(2));
if(status & 128) {
return deferred.reject("Warning: new baseline image; add image with:\n\t git add " + filename);
} else if(status & 256) {
return deferred.reject("Error: screenshot differs from baseline image; see differences:\n\tgit dt " + filename + "\n If changes are acceptable:\n\tgit add " + filename);
}
return deferred.fulfill();
});
});
open(...argus) {
let _realRepo
try {
_realRepo = _realGit.open(...argus)
} catch (err) {
_realRepo = null
}
if (!_realRepo) {
return null
}
return new Proxy(_realRepo, {
get(obj, key) {
const original = obj[key]
if (typeof original === 'function') {
return function (...args) {
let result
try {
result = original.apply(obj, args)
} catch (e) {
console.log('proxy intercepted an error', e)
constructor(path, options = {}) {
this.id = nextId++;
this.emitter = new Emitter();
this.subscriptions = new CompositeDisposable();
this.repo = GitUtils.open(path);
if (this.repo == null) {
throw new Error(`No Git repository found searching path: ${path}`);
}
this.statusRefreshCount = 0;
this.statuses = {};
this.upstream = { ahead: 0, behind: 0 };
for (let submodulePath in this.repo.submodules) {
const submoduleRepo = this.repo.submodules[submodulePath];
submoduleRepo.upstream = { ahead: 0, behind: 0 };
}
this.project = options.project;
this.config = options.config;
if (options.refreshOnWindowFocus || options.refreshOnWindowFocus == null) {
var ModuleWatcher = function(baseGitRepoPath) {
events.EventEmitter.call(this);
var me = this;
me.path = baseGitRepoPath.replace(/[\\\/]$/, '');
me.repo = require('git-utils').open(me.path);
me.changeTimer = null;
me.shouldRefreshIndex = false;
};