public static IList<string> ListAllReferenceNames(RepositorySafeHandle repo, GitReferenceType types) { UnSafeNativeMethods.git_strarray strArray; var res = UnSafeNativeMethods.git_reference_listall(out strArray, repo, types); Ensure.Success(res); return BuildListOf(strArray); }
public static IList<string> ListAllTagNames(RepositorySafeHandle repo) { UnSafeNativeMethods.git_strarray strArray; var res = UnSafeNativeMethods.git_tag_list(out strArray, repo); Ensure.Success(res); return BuildListOf(strArray); }
public static extern int git_tag_list(out git_strarray array, RepositorySafeHandle repo);
private void Process(RepositorySafeHandle handle) { int res = NativeMethods.git_status_foreach(handle, callback, IntPtr.Zero); Ensure.Success(res); }
public static extern int git_reference_create_oid(out IntPtr reference, RepositorySafeHandle repo, string name, ref GitOid oid, bool force);
public static extern int git_commit_create(out GitOid oid, RepositorySafeHandle repo, string updateRef, GitSignature author, GitSignature committer, string message, IntPtr tree, int parentCount, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 7)] [In] IntPtr[] parents);
public static extern int git_tag_delete(RepositorySafeHandle repo, string tagName);
public static extern int git_tag_create(out GitOid oid, RepositorySafeHandle repo, string name, IntPtr target, GitSignature signature, string message, bool force);
public static extern int git_reference_lookup(out IntPtr reference, RepositorySafeHandle repo, string name);
public static extern int git_reference_create_symbolic(out IntPtr reference, RepositorySafeHandle repo, string name, string target, bool force);
public static extern int git_commit_create_o(out GitOid oid, RepositorySafeHandle repo, string updateRef, IntPtr author, IntPtr committer, string message, IntPtr tree, int parentCount, IntPtr parents);
public static extern int git_commit_create(out GitOid oid, RepositorySafeHandle repo, string updateRef, GitSignature author, GitSignature committer, string message, ref GitOid treeOid, int parentCount, ref GitOid[] parents);
public static extern int git_tag_create_f(out GitOid oid, RepositorySafeHandle repo, string name, ref GitOid target, GitObjectType type, GitSignature signature, string message);
public static extern int git_index_open_inrepo(out IndexSafeHandle index, RepositorySafeHandle repo);
public static extern IntPtr git_repository_workdir(RepositorySafeHandle repository);
public static extern int git_revwalk_new(out RevWalkerSafeHandle walker, RepositorySafeHandle repo);
public static extern IntPtr git_repository_database(RepositorySafeHandle repository);
public static extern int git_tag_create_lightweight(out GitOid oid, RepositorySafeHandle repo, string name, IntPtr target, bool force);
public static extern int git_repository_head_detached(RepositorySafeHandle repo);
public static extern int git_tree_entry_2object(out IntPtr obj, RepositorySafeHandle repo, IntPtr entry);
public static extern int git_repository_index(out IndexSafeHandle index, RepositorySafeHandle repo);
public static extern int git_object_lookup_prefix(out IntPtr obj, RepositorySafeHandle repo, ref GitOid id, uint len, GitObjectType type);
public static extern int git_repository_init(out RepositorySafeHandle repository, string path, [MarshalAs(UnmanagedType.Bool)] bool isBare);
internal RepositoryStatus(RepositorySafeHandle handle) { callback = new NativeMethods.status_callback(StateChanged); Process(handle); isDirty = statusEntries.Count != 0; }
public static extern bool git_repository_is_bare(RepositorySafeHandle handle);
public static extern int git_reference_listall(out git_strarray array, RepositorySafeHandle repo, GitReferenceType flags);
public static extern int git_repository_is_empty(RepositorySafeHandle repo);
/// <summary> /// Initializes a new instance of the <see cref="Repository"/> class, providing ooptional behavioral overrides through <paramref name="options"/> parameter. /// <para>For a standard repository, <paramref name="path"/> should either point to the ".git" folder or to the working directory. For a bare repository, <paramref name="path"/> should directly point to the repository folder.</para> /// </summary> /// <param name="path"> /// The path to the git repository to open, can be either the path to the git directory (for non-bare repositories this /// would be the ".git" folder inside the working directory) or the path to the working directory. /// </param> /// <param name="options"> /// Overrides to the way a repository is opened. /// </param> public Repository(string path, RepositoryOptions options = null) { Ensure.ArgumentNotNullOrEmptyString(path, "path"); try { handle = Proxy.git_repository_open(path); RegisterForCleanup(handle); isBare = Proxy.git_repository_is_bare(handle); Func <Index> indexBuilder = () => new Index(this); string configurationGlobalFilePath = null; string configurationXDGFilePath = null; string configurationSystemFilePath = null; if (options != null) { bool isWorkDirNull = string.IsNullOrEmpty(options.WorkingDirectoryPath); bool isIndexNull = string.IsNullOrEmpty(options.IndexPath); if (isBare && (isWorkDirNull ^ isIndexNull)) { throw new ArgumentException( "When overriding the opening of a bare repository, both RepositoryOptions.WorkingDirectoryPath an RepositoryOptions.IndexPath have to be provided."); } isBare = false; if (!isIndexNull) { indexBuilder = () => new Index(this, options.IndexPath); } if (!isWorkDirNull) { Proxy.git_repository_set_workdir(handle, options.WorkingDirectoryPath); } configurationGlobalFilePath = options.GlobalConfigurationLocation; configurationXDGFilePath = options.XdgConfigurationLocation; configurationSystemFilePath = options.SystemConfigurationLocation; } if (!isBare) { index = indexBuilder(); } commits = new CommitLog(this); refs = new ReferenceCollection(this); branches = new BranchCollection(this); tags = new TagCollection(this); stashes = new StashCollection(this); info = new Lazy <RepositoryInformation>(() => new RepositoryInformation(this, isBare)); config = new Lazy <Configuration>( () => RegisterForCleanup(new Configuration(this, configurationGlobalFilePath, configurationXDGFilePath, configurationSystemFilePath))); odb = new Lazy <ObjectDatabase>(() => new ObjectDatabase(this)); diff = new Diff(this); notes = new NoteCollection(this); ignore = new Ignore(this); network = new Lazy <Network>(() => new Network(this)); pathCase = new Lazy <PathCase>(() => new PathCase(this)); submodules = new SubmoduleCollection(this); EagerlyLoadTheConfigIfAnyPathHaveBeenPassed(options); } catch { CleanupDisposableDependencies(); throw; } }
public static extern int git_repository_open(out RepositorySafeHandle repository, string path);
public static extern IntPtr git_repository_path(RepositorySafeHandle repository, GitRepositoryPathId pathIdentifier);
public static extern IntPtr git_repository_path(RepositorySafeHandle repository);