nl_tokens: Set a new change to the current WorkingState . Attempt to resolve some cases like removing a file that was added in the first place .
pl_tokens: function setChange ( repoState , filepath , change ) { let workingState = repoState . getCurrentState ( ) ; let changes = workingState . getChanges ( ) ; const type = change . getType ( ) ; // Simplify change when possible if ( type === CHANGE_TYPE . REMOVE && ! workingState . getTreeEntries ( ) . has ( filepath ) ) { // Removing a file that did not exist before changes = changes . delete ( filepath ) ; } else if ( type === CHANGE_TYPE . CREATE && workingState . getTreeEntries ( ) . has ( filepath ) ) { // Adding back a file that existed already changes = changes . set ( filepath , change . set ( 'type' , CHANGE_TYPE . UPDATE ) ) ; } else { // Push changes to list changes = changes . set ( filepath , change ) ; } // Update workingState and repoState workingState = workingState . <mask> ( 'changes' , changes ) ; return RepoUtils . updateCurrentWorkingState ( repoState , workingState ) ; }