Example #1
0
        private TreeEntry RetrieveFromPath(FilePath relativePath)
        {
            if (relativePath.IsNullOrEmpty())
            {
                return(null);
            }

            using (TreeEntrySafeHandle_Owned treeEntryPtr = Proxy.git_tree_entry_bypath(repo.Handle, Id, relativePath))
            {
                if (treeEntryPtr == null)
                {
                    return(null);
                }

                string posixPath  = relativePath.Posix;
                string filename   = posixPath.Split('/').Last();
                string parentPath = posixPath.Substring(0, posixPath.Length - filename.Length);
                return(new TreeEntry(treeEntryPtr, Id, repo, path.Combine(parentPath)));
            }
        }
Example #2
0
 internal static extern int git_tree_entry_bypath(
     out TreeEntrySafeHandle_Owned tree,
     GitObjectSafeHandle root,
     [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath treeentry_path);