private void deleteCommits(){
  int size=commitsToDelete.size();
  if (size > 0) {
    Throwable firstThrowable=null;
    for (int i=0; i < size; i++) {
      CommitPoint commit=commitsToDelete.get(i);
      if (infoStream.isEnabled("IFD")) {
        infoStream.message("IFD","deleteCommits: now decRef commit \"" + commit.getSegmentsFileName() + "\"");
      }
      try {
        decRef(commit.files);
      }
 catch (      Throwable t) {
        if (firstThrowable == null) {
          firstThrowable=t;
        }
      }
    }
    commitsToDelete.clear();
    IOUtils.reThrowUnchecked(firstThrowable);
    size=commits.size();
    int readFrom=0;
    int writeTo=0;
    while (readFrom < size) {
      CommitPoint commit=commits.get(readFrom);
      if (!commit.deleted) {
        if (writeTo != readFrom) {
          commits.set(writeTo,commits.get(readFrom));
        }
        writeTo++;
      }
      readFrom++;
    }
    while (size > writeTo) {
      commits.remove(size - 1);
      size--;
    }
  }
}

private void deleteCommits ( ) { int size = commitsToDelete . size ( ) ; if ( size > 0 ) { Throwable firstThrowable = null ; for ( int i = 0 ; i < size ; i ++ ) { CommitPoint commit = commitsToDelete . get ( i ) ; if ( infoStream . isEnabled ( "IFD" ) ) { infoStream . message ( "IFD" , "deleteCommits: now decRef commit \"" + commit . getSegmentsFileName ( ) + "\"" ) ; } try { decRef ( commit . files ) ; } catch ( Throwable t ) { if ( firstThrowable == null ) { firstThrowable = t ; } } } commitsToDelete . clear ( ) ; IOUtils . reThrowUnchecked ( firstThrowable ) ; size = commits . size ( ) ; int readFrom = 0 ; int writeTo = 0 ; while ( readFrom < size ) { CommitPoint commit = commits . get ( readFrom ) ; if ( ! commit . deleted ) { if ( writeTo != readFrom ) { commits . set ( writeTo , commits . get ( readFrom ) ) ; } writeTo ++ ; } readFrom ++ ; } while ( size > writeTo ) { commits . remove ( size - 1 ) ; size -- ; } } }
remove the commitpoints in the commitstodelete list by decref ' ing all files from each segmentinfos .
