function move(repoState, filepath, newFilepath) {
    if (filepath === newFilepath) {
        return repoState;
    }

    const initialWorkingState = repoState.getCurrentState();

    // Create new file, with Sha if possible
    const sha = WorkingUtils.findSha(initialWorkingState, filepath);
    let changeNewFile;
    if (sha) {
        changeNewFile = Change.createCreateFromSha(sha);
    } else {
        // Content not available as blob
        const blob = read(repoState, filepath);
        const contentBuffer = blob.getAsBuffer();
        changeNewFile = Change.createCreate(contentBuffer);
    }

    // Remove old file
    const removedRepoState = remove(repoState, filepath);
    // Add new file
    return ChangeUtils.setChange(removedRepoState, newFilepath, changeNewFile);
}
function move(repoState, filepath, newFilepath) {
    if (filepath === newFilepath) {
        return repoState;
    }

    const initialWorkingState = repoState.getCurrentState();

    // Create new file, with Sha if possible
    const sha = WorkingUtils.findSha(initialWorkingState, filepath);
    let changeNewFile;
    if (sha) {
        changeNewFile = Change.createCreateFromSha(sha);
    } else {
        // Content not available as blob
        const blob = read(repoState, filepath);
        const contentBuffer = blob.getAsBuffer();
        changeNewFile = Change.createCreate(contentBuffer);
    }

    // Remove old file
    const removedRepoState = remove(repoState, filepath);
    // Add new file
    return ChangeUtils.setChange(removedRepoState, newFilepath, changeNewFile);
}
function move ( repoState , filepath , newFilepath ) { if ( filepath === newFilepath ) { return repoState ; } const initialWorkingState = repoState . getCurrentState ( ) ; // Create new file, with Sha if possible const sha = WorkingUtils . findSha ( initialWorkingState , filepath ) ; let changeNewFile ; if ( sha ) { changeNewFile = Change . createCreateFromSha ( sha ) ; } else { // Content not available as blob const blob = read ( repoState , filepath ) ; const contentBuffer = blob . getAsBuffer ( ) ; changeNewFile = Change . createCreate ( contentBuffer ) ; } // Remove old file const removedRepoState = remove ( repoState , filepath ) ; // Add new file return ChangeUtils . setChange ( removedRepoState , newFilepath , changeNewFile ) ; }
Rename a file
@return {RepositoryState}
Rename a file