/// <summary> /// Create a generator and advance it to the submodule entry at the given /// path /// </summary> /// <param name="repository"></param> /// <param name="treeId"> /// the root of a tree containing both a submodule at the given path /// and .gitmodules at the root. /// </param> /// <param name="path"></param> /// <returns>generator at given path, null if no submodule at given path</returns> /// <exception cref="System.IO.IOException">System.IO.IOException</exception> public static NGit.Submodule.SubmoduleWalk ForPath(Repository repository, AnyObjectId treeId, string path) { NGit.Submodule.SubmoduleWalk generator = new NGit.Submodule.SubmoduleWalk(repository ); try { generator.SetTree(treeId); PathFilter filter = PathFilter.Create(path); generator.SetFilter(filter); generator.SetRootTree(treeId); while (generator.Next()) { if (filter.IsDone(generator.walk)) { return(generator); } } } catch (IOException e) { generator.Release(); throw; } generator.Release(); return(null); }
/// <summary> /// Create a generator to walk over the submodule entries currently in the /// index /// The /// <code>.gitmodules</code> /// file is read from the index. /// </summary> /// <param name="repository"></param> /// <returns>generator over submodule index entries</returns> /// <exception cref="System.IO.IOException">System.IO.IOException</exception> public static NGit.Submodule.SubmoduleWalk ForIndex(Repository repository) { NGit.Submodule.SubmoduleWalk generator = new NGit.Submodule.SubmoduleWalk(repository ); try { DirCache index = repository.ReadDirCache(); generator.SetTree(new DirCacheIterator(index)); } catch (IOException e) { generator.Release(); throw; } return(generator); }
/// <summary> /// Create a generator to walk over the submodule entries currently in the /// index /// The /// <code>.gitmodules</code> /// file is read from the index. /// </summary> /// <param name="repository"></param> /// <returns>generator over submodule index entries</returns> /// <exception cref="System.IO.IOException">System.IO.IOException</exception> public static NGit.Submodule.SubmoduleWalk ForIndex(Repository repository) { NGit.Submodule.SubmoduleWalk generator = new NGit.Submodule.SubmoduleWalk(repository ); try { DirCache index = repository.ReadDirCache(); generator.SetTree(new DirCacheIterator(index)); } catch (IOException e) { generator.Release(); throw; } return generator; }
/// <summary> /// Create a generator and advance it to the submodule entry at the given /// path /// </summary> /// <param name="repository"></param> /// <param name="treeId"> /// the root of a tree containing both a submodule at the given path /// and .gitmodules at the root. /// </param> /// <param name="path"></param> /// <returns>generator at given path, null if no submodule at given path</returns> /// <exception cref="System.IO.IOException">System.IO.IOException</exception> public static NGit.Submodule.SubmoduleWalk ForPath(Repository repository, AnyObjectId treeId, string path) { NGit.Submodule.SubmoduleWalk generator = new NGit.Submodule.SubmoduleWalk(repository ); try { generator.SetTree(treeId); PathFilter filter = PathFilter.Create(path); generator.SetFilter(filter); generator.SetRootTree(treeId); while (generator.Next()) { if (filter.IsDone(generator.walk)) { return generator; } } } catch (IOException e) { generator.Release(); throw; } generator.Release(); return null; }