src/utils/working.js
function getMergedTreeEntries(workingState) {
    const removedOrModified = workingState.getChanges().groupBy((change, path) => {
        if (change.getType() === CHANGES.REMOVE) {
            return 'remove';
        } else {
            // Must be UDPATE or CREATE
            return 'modified';
        }
    });

    const setToRemove = Immutable.Set.fromKeys(removedOrModified.get('remove', []));

    const withoutRemoved = workingState.getTreeEntries().filter((treeEntry, path) => {
        return !setToRemove.contains(path);
    });

    const addedTreeEntries = removedOrModified.get('modified', []).map(
        function toTreeEntry(change) {
            return new TreeEntry({
                sha: change.hasSha() ? change.getSha() : null,
                mode: '100644'
            });
        }
    );

    return withoutRemoved.concat(addedTreeEntries);
}
function getMergedTreeEntries(workingState) {
    const removedOrModified = workingState.getChanges().groupBy((change, path) => {
        if (change.getType() === CHANGES.REMOVE) {
            return 'remove';
        } else {
            // Must be UDPATE or CREATE
            return 'modified';
        }
    });

    const setToRemove = Immutable.Set.fromKeys(removedOrModified.get('remove', []));

    const withoutRemoved = workingState.getTreeEntries().filter((treeEntry, path) => {
        return !setToRemove.contains(path);
    });

    const addedTreeEntries = removedOrModified.get('modified', []).map(
        function toTreeEntry(change) {
            return new TreeEntry({
                sha: change.hasSha() ? change.getSha() : null,
                mode: '100644'
            });
        }
    );

    return withoutRemoved.concat(addedTreeEntries);
}
function getMergedTreeEntries ( workingState ) { const removedOrModified = workingState . getChanges ( ) . groupBy ( ( change , path ) => { if ( change . getType ( ) === CHANGES . REMOVE ) { return 'remove' ; } else { // Must be UDPATE or CREATE return 'modified' ; } } ) ; const setToRemove = Immutable . Set . fromKeys ( removedOrModified . get ( 'remove' , [ ] ) ) ; const withoutRemoved = workingState . getTreeEntries ( ) . filter ( ( treeEntry , path ) => { return ! setToRemove . contains ( path ) ; } ) ; const addedTreeEntries = removedOrModified . get ( 'modified' , [ ] ) . map ( function toTreeEntry ( change ) { return new TreeEntry ( { sha : change . hasSha ( ) ? change . getSha ( ) : null , mode : '100644' } ) ; } ) ; return withoutRemoved . concat ( addedTreeEntries ) ; }
Returns a Map of TreeEntry, with sha null when the content is not available as sha.
@param {WorkingState}
@return {Map<TreeEntries>}
Returns a Map of TreeEntry with sha null when the content is not available as sha .