/** * Update the DirCache with the contents of {@link #entries}. * <p> * This method should be invoked only during an implementation of * {@link #finish()}, and only after {@link #entries} is sorted. */ protected void replace() { checkNameConflicts(); if (entryCnt < entries.length / 2) { final DirCacheEntry[] n = new DirCacheEntry[entryCnt]; System.arraycopy(entries, 0, n, 0, entryCnt); entries = n; } cache.replace(entries, entryCnt); }
/** {@inheritDoc} */ @Override public boolean commit() throws IOException { if (edits.isEmpty()) { // No changes? Don't rewrite the index. // cache.unlock(); return true; } return super.commit(); }
/** * Finish, write, commit this change, and release the index lock. * <p> * If this method fails (returns false) the lock is still released. * <p> * This is a utility method for applications as the finish-write-commit * pattern is very common after using a builder to update entries. * * @return true if the commit was successful and the file contains the new * data; false if the commit failed and the file remains with the * old data. * @throws java.lang.IllegalStateException * the lock is not held. * @throws java.io.IOException * the output file could not be created. The caller no longer * holds the lock. */ public boolean commit() throws IOException { finish(); cache.write(); return cache.commit(); } }
int prefixLen = lastSlash(ePath) + 1; if (!startsWith(ePath, nPath, prefixLen)) { int s = nextSlash(nPath, prefixLen); int m = s < nPath.length ? TYPE_TREE : n.getRawMode(); int cmp = compareSameName(
int prefixLen = lastSlash(ePath) + 1; if (!startsWith(ePath, nPath, prefixLen)) { int s = nextSlash(nPath, prefixLen); int m = s < nPath.length ? TYPE_TREE : n.getRawMode(); int cmp = compareSameName(
int prefixLen = lastSlash(ePath) + 1; if (!startsWith(ePath, nPath, prefixLen)) { int s = nextSlash(nPath, prefixLen); int m = s < nPath.length ? TYPE_TREE : n.getRawMode(); int cmp = compareSameName(
/** {@inheritDoc} */ @Override public boolean commit() throws IOException { if (edits.isEmpty()) { // No changes? Don't rewrite the index. // cache.unlock(); return true; } return super.commit(); }
/** * Update the DirCache with the contents of {@link #entries}. * <p> * This method should be invoked only during an implementation of * {@link #finish()}, and only after {@link #entries} is sorted. */ protected void replace() { checkNameConflicts(); if (entryCnt < entries.length / 2) { final DirCacheEntry[] n = new DirCacheEntry[entryCnt]; System.arraycopy(entries, 0, n, 0, entryCnt); entries = n; } cache.replace(entries, entryCnt); }
/** * Finish, write, commit this change, and release the index lock. * <p> * If this method fails (returns false) the lock is still released. * <p> * This is a utility method for applications as the finish-write-commit * pattern is very common after using a builder to update entries. * * @return true if the commit was successful and the file contains the new * data; false if the commit failed and the file remains with the * old data. * @throws IllegalStateException * the lock is not held. * @throws IOException * the output file could not be created. The caller no longer * holds the lock. */ public boolean commit() throws IOException { finish(); cache.write(); return cache.commit(); } }
@Override public boolean commit() throws IOException { if (edits.isEmpty()) { // No changes? Don't rewrite the index. // cache.unlock(); return true; } return super.commit(); }
/** * Update the DirCache with the contents of {@link #entries}. * <p> * This method should be invoked only during an implementation of * {@link #finish()}, and only after {@link #entries} is sorted. */ protected void replace() { checkNameConflicts(); if (entryCnt < entries.length / 2) { final DirCacheEntry[] n = new DirCacheEntry[entryCnt]; System.arraycopy(entries, 0, n, 0, entryCnt); entries = n; } cache.replace(entries, entryCnt); }
/** * Finish, write, commit this change, and release the index lock. * <p> * If this method fails (returns false) the lock is still released. * <p> * This is a utility method for applications as the finish-write-commit * pattern is very common after using a builder to update entries. * * @return true if the commit was successful and the file contains the new * data; false if the commit failed and the file remains with the * old data. * @throws java.lang.IllegalStateException * the lock is not held. * @throws java.io.IOException * the output file could not be created. The caller no longer * holds the lock. */ public boolean commit() throws IOException { finish(); cache.write(); return cache.commit(); } }