throws CorruptObjectException, IOException { DirCache c = lock(indexLocation, fs); c.registerIndexChangedListener(indexChangedListener); return c;
return DirCache.lock(this, l);
/** * Create a new in-core index representation, lock it, and read from disk. * <p> * The new index will be locked and then read before it is returned to the * caller. Read failures are reported as exceptions and therefore prevent * the method from returning a partially populated index. On read failure, * the lock is released. * * @param repository * repository containing the index to lock and read * @param indexChangedListener * listener to be informed when DirCache is committed * @return a cache representing the contents of the specified index file (if * it exists) or an empty cache if the file does not exist. * @throws java.io.IOException * the index file is present but could not be read, or the lock * could not be obtained. * @throws org.eclipse.jgit.errors.CorruptObjectException * the index file is using a format or extension that this * library does not support. * @since 2.0 */ public static DirCache lock(final Repository repository, final IndexChangedListener indexChangedListener) throws CorruptObjectException, IOException { DirCache c = lock(repository.getIndexFile(), repository.getFS(), indexChangedListener); c.repository = repository; return c; }
throws CorruptObjectException, IOException { final DirCache c = new DirCache(indexLocation, fs); if (!c.lock()) throw new LockFailedException(indexLocation);
throws CorruptObjectException, IOException { DirCache c = lock(indexLocation, fs); c.registerIndexChangedListener(indexChangedListener); return c;
return DirCache.lock(this, l);
throws CorruptObjectException, IOException { DirCache c = lock(indexLocation, fs); c.registerIndexChangedListener(indexChangedListener); return c;
return DirCache.lock(this, l);
/** * Create a new in-core index representation, lock it, and read from disk. * <p> * The new index will be locked and then read before it is returned to the * caller. Read failures are reported as exceptions and therefore prevent * the method from returning a partially populated index. On read failure, * the lock is released. * * @param repository * repository containing the index to lock and read * @param indexChangedListener * listener to be informed when DirCache is committed * @return a cache representing the contents of the specified index file (if * it exists) or an empty cache if the file does not exist. * @throws java.io.IOException * the index file is present but could not be read, or the lock * could not be obtained. * @throws org.eclipse.jgit.errors.CorruptObjectException * the index file is using a format or extension that this * library does not support. * @since 2.0 */ public static DirCache lock(final Repository repository, final IndexChangedListener indexChangedListener) throws CorruptObjectException, IOException { DirCache c = lock(repository.getIndexFile(), repository.getFS(), indexChangedListener); c.repository = repository; return c; }
/** * Create a new in-core index representation, lock it, and read from disk. * <p> * The new index will be locked and then read before it is returned to the * caller. Read failures are reported as exceptions and therefore prevent * the method from returning a partially populated index. On read failure, * the lock is released. * * @param repository * repository containing the index to lock and read * @param indexChangedListener * listener to be informed when DirCache is committed * @return a cache representing the contents of the specified index file (if * it exists) or an empty cache if the file does not exist. * @throws IOException * the index file is present but could not be read, or the lock * could not be obtained. * @throws CorruptObjectException * the index file is using a format or extension that this * library does not support. * @since 2.0 */ public static DirCache lock(final Repository repository, final IndexChangedListener indexChangedListener) throws CorruptObjectException, IOException { DirCache c = lock(repository.getIndexFile(), repository.getFS(), indexChangedListener); c.repository = repository; return c; }
@Override protected void run() throws Exception { final DirCache cache = db.readDirCache(); if (!cache.lock()) throw die(CLIText.get().failedToLockIndex); cache.read(); cache.write(); if (!cache.commit()) throw die(CLIText.get().failedToCommitIndex); } }
throws CorruptObjectException, IOException { final DirCache c = new DirCache(indexLocation, fs); if (!c.lock()) throw new LockFailedException(indexLocation);
throws CorruptObjectException, IOException { final DirCache c = new DirCache(indexLocation, fs); if (!c.lock()) throw new LockFailedException(indexLocation);