In180aacd470
a "pathsToIngore" filter was introduced that didn't work properly and caused all paths to be ignored. This behavior was likely intended to prevent snake_case filename checking on files in the webpackShims directory but that is being properly handled by [check_added_filename](8f9ec7d932/tasks/check_added_filenames.js (L11)
).
41 lines
932 B
JavaScript
41 lines
932 B
JavaScript
import SimpleGit from 'simple-git';
|
|
import { promisify } from 'bluebird';
|
|
import { includes } from 'lodash';
|
|
|
|
export default function filesToCommit(path) {
|
|
const simpleGit = new SimpleGit(path);
|
|
const gitDiff = promisify(simpleGit.diff, simpleGit);
|
|
|
|
return gitDiff(['--name-status', '--cached'])
|
|
.then(output => {
|
|
return output
|
|
.split('\n')
|
|
.map(line => line.trim().split('\t'))
|
|
.filter(parts => parts.length === 2)
|
|
.map(parts => {
|
|
const status = parts.shift();
|
|
const name = parts.join('\t').trim();
|
|
return { status, name };
|
|
});
|
|
});
|
|
};
|
|
|
|
export function getFilename(file) {
|
|
return file.name;
|
|
}
|
|
|
|
export function isAdded(file) {
|
|
return file.status === 'A';
|
|
};
|
|
|
|
export function isDeleted(file) {
|
|
return file.status === 'D';
|
|
}
|
|
|
|
export function isUnmerged(file) {
|
|
return file.status === 'U';
|
|
}
|
|
|
|
export function isStaged(file) {
|
|
return !isDeleted(file) && !isUnmerged(file);
|
|
}
|