function findSha(workingState, filepath) {
    // Lookup potential changes
    const change = workingState.getChanges().get(filepath);
    // Else lookup tree
    const treeEntry = workingState.getTreeEntries().get(filepath);

    if (change) {
        if (change.getType() == CHANGES.REMOVE) {
            throw error.fileNotFound(filepath);
        } else {
            return change.getSha();
        }
    } else if (treeEntry) {
        return treeEntry.getSha();
    } else {
        throw error.fileNotFound(filepath);
    }
}
function findSha(workingState, filepath) {
    // Lookup potential changes
    const change = workingState.getChanges().get(filepath);
    // Else lookup tree
    const treeEntry = workingState.getTreeEntries().get(filepath);

    if (change) {
        if (change.getType() == CHANGES.REMOVE) {
            throw error.fileNotFound(filepath);
        } else {
            return change.getSha();
        }
    } else if (treeEntry) {
        return treeEntry.getSha();
    } else {
        throw error.fileNotFound(filepath);
    }
}
function findSha ( workingState , filepath ) { // Lookup potential changes const change = workingState . getChanges ( ) . get ( filepath ) ; // Else lookup tree const treeEntry = workingState . getTreeEntries ( ) . get ( filepath ) ; if ( change ) { if ( change . getType ( ) == CHANGES . REMOVE ) { throw error . fileNotFound ( filepath ) ; } else { return change . getSha ( ) ; } } else if ( treeEntry ) { return treeEntry . getSha ( ) ; } else { throw error . fileNotFound ( filepath ) ; } }
Attempts to find a SHA if available for the  given file
@param {Path}
@return {Sha | Null} null if Sha cannot be retrieved (because of pending change)
@throws NOT_FOUND if the file does not exist or was removed
Attempts to find a SHA if available for the given file