GitSharp.Core.DirectoryCache.DirCache.unlock C# (CSharp) Method

unlock() public method

Unlock this file and abort this change. The temporary file (if created) is deleted before returning.
public unlock ( ) : void
return void
		public void unlock()
		{
			LockFile tmp = _myLock;
			if (tmp != null)
			{
				_myLock = null;
				tmp.Unlock();
			}
		}

Usage Example

Example #1
0
        ///	<summary>
        /// Create a new in-core index representation, lock it, and read from disk.
        /// <para />
        /// 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.
        /// </summary>
        /// <param name="indexLocation">
        /// location of the index file on disk.
        /// </param>
        /// <returns>
        /// A cache representing the contents of the specified index file (if
        /// it exists) or an empty cache if the file does not exist.
        /// </returns>
        /// <exception cref="IOException">
        /// The index file is present but could not be read, or the lock
        /// could not be obtained.
        /// </exception>
        /// <exception cref="CorruptObjectException">
        /// the index file is using a format or extension that this
        /// library does not support.
        /// </exception>
        public static DirCache Lock(FileInfo indexLocation)
        {
            var c = new DirCache(indexLocation);

            if (!c.Lock())
            {
                throw new IOException("Cannot lock " + indexLocation);
            }

            try
            {
                c.read();
            }
            catch (Exception)
            {
                c.unlock();
                throw;
            }

            return(c);
        }
All Usage Examples Of GitSharp.Core.DirectoryCache.DirCache::unlock