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);
Exemplo n.º 4
0
        private void Process(RepositorySafeHandle handle)
        {
            int res = NativeMethods.git_status_foreach(handle, callback, IntPtr.Zero);

            Ensure.Success(res);
        }
Exemplo n.º 5
0
 public static extern int git_reference_create_oid(out IntPtr reference, RepositorySafeHandle repo, string name, ref GitOid oid, bool force);
Exemplo n.º 6
0
 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);
Exemplo n.º 7
0
 public static extern int git_tag_delete(RepositorySafeHandle repo, string tagName);
Exemplo n.º 8
0
 public static extern int git_tag_create(out GitOid oid, RepositorySafeHandle repo, string name, IntPtr target, GitSignature signature, string message, bool force);
Exemplo n.º 9
0
 public static extern int git_reference_lookup(out IntPtr reference, RepositorySafeHandle repo, string name);
Exemplo n.º 10
0
 public static extern int git_reference_create_symbolic(out IntPtr reference, RepositorySafeHandle repo, string name, string target, bool force);
Exemplo n.º 11
0
 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);
Exemplo n.º 12
0
 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);
Exemplo n.º 13
0
 public static extern int git_tag_create_f(out GitOid oid, RepositorySafeHandle repo, string name, ref GitOid target, GitObjectType type, GitSignature signature, string message);
Exemplo n.º 14
0
 public static extern int git_index_open_inrepo(out IndexSafeHandle index, RepositorySafeHandle repo);
Exemplo n.º 15
0
 public static extern IntPtr git_repository_workdir(RepositorySafeHandle repository);
Exemplo n.º 16
0
 public static extern int git_revwalk_new(out RevWalkerSafeHandle walker, RepositorySafeHandle repo);
Exemplo n.º 17
0
 public static extern IntPtr git_repository_database(RepositorySafeHandle repository);
Exemplo n.º 18
0
 public static extern int git_tag_create_lightweight(out GitOid oid, RepositorySafeHandle repo, string name, IntPtr target, bool force);
Exemplo n.º 19
0
 public static extern int git_repository_head_detached(RepositorySafeHandle repo);
Exemplo n.º 20
0
 public static extern int git_tree_entry_2object(out IntPtr obj, RepositorySafeHandle repo, IntPtr entry);
Exemplo n.º 21
0
 public static extern int git_repository_index(out IndexSafeHandle index, RepositorySafeHandle repo);
Exemplo n.º 22
0
 public static extern int git_object_lookup_prefix(out IntPtr obj, RepositorySafeHandle repo, ref GitOid id, uint len, GitObjectType type);
Exemplo n.º 23
0
 public static extern int git_repository_init(out RepositorySafeHandle repository, string path, [MarshalAs(UnmanagedType.Bool)] bool isBare);
Exemplo n.º 24
0
 internal RepositoryStatus(RepositorySafeHandle handle)
 {
     callback = new NativeMethods.status_callback(StateChanged);
     Process(handle);
     isDirty = statusEntries.Count != 0;
 }
Exemplo n.º 25
0
 public static extern bool git_repository_is_bare(RepositorySafeHandle handle);
Exemplo n.º 26
0
 public static extern int git_reference_listall(out git_strarray array, RepositorySafeHandle repo, GitReferenceType flags);
Exemplo n.º 27
0
 public static extern int git_repository_is_empty(RepositorySafeHandle repo);
Exemplo n.º 28
0
        /// <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;
            }
        }
Exemplo n.º 29
0
 public static extern int git_repository_open(out RepositorySafeHandle repository, string path);
Exemplo n.º 30
0
 public static extern IntPtr git_repository_path(RepositorySafeHandle repository, GitRepositoryPathId pathIdentifier);
Exemplo n.º 31
0
 public static extern IntPtr git_repository_path(RepositorySafeHandle repository);