/// <summary>Try to establish an update lock on the cache file.</summary> /// <remarks>Try to establish an update lock on the cache file.</remarks> /// <returns> /// true if the lock is now held by the caller; false if it is held /// by someone else. /// </returns> /// <exception cref="System.IO.IOException"> /// the output file could not be created. The caller does not /// hold the lock. /// </exception> public virtual bool Lock() { if (liveFile == null) { throw new IOException(JGitText.Get().dirCacheDoesNotHaveABackingFile); } LockFile tmp = new LockFile(liveFile, fs); if (tmp.Lock()) { tmp.SetNeedStatInformation(true); myLock = tmp; return(true); } return(false); }