import { gpExecSync } from '.' ; import { ExitFailedError } from '../errors' ; function doChangesExist ( cmd ) { return ( gpExecSync ( { command : cmd , } , ( ) => { throw new ExitFailedError ( `Failed to check current dir for untracked/uncommitted changes.` ) ; } ) . toString ( ) . trim ( ) !== '0' ) ; } export function uncommittedChanges ( ) { return doChangesExist ( `git status -u --porcelain=v1 2>/dev/null | wc -l` ) ; } export function unstagedChanges ( ) { return doChangesExist ( `git ls-files --others --exclude-standard | wc -l` ) ; } export function trackedUncommittedChanges ( ) { return doChangesExist ( `git status -uno --porcelain=v1 2>/dev/null | wc -l` ) ; }