Provides high level information about a repository.
Ejemplo n.º 1
0
        public RepoTracker(Repository repo)
        {
            _repoInfo = repo.Info;

            _fileWatcher = new FileSystemWatcher();
            _fileWatcher.Path = _repoInfo.Path;
            _fileWatcher.Filter = "*.*";
            _fileWatcher.Created += fileWatcher_Created;
            _fileWatcher.Deleted += fileWatcher_Deleted;
            _fileWatcher.Changed += fileWatcher_Changed;
            _fileWatcher.EnableRaisingEvents = true;

            _timer = new Timer(500);
            _timer.Elapsed += timer_Elapsed;
            //_timer.Start();
        }
Ejemplo n.º 2
0
        /// <summary>
        ///   Initializes a new instance of the <see cref = "Repository" /> class.
        ///     <para>For a standard repository, <paramref name="path"/> should point to the ".git" folder. 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.</param>
        public Repository(string path)
        {
            Ensure.ArgumentNotNullOrEmptyString(path, "path");

            var res = NativeMethods.git_repository_open(out handle, PosixPathHelper.ToPosix(path));
            Ensure.Success(res);

            string normalizedPath = NativeMethods.git_repository_path(handle).MarshallAsString();
            string normalizedWorkDir = NativeMethods.git_repository_workdir(handle).MarshallAsString();

            Info = new RepositoryInformation(this, normalizedPath, normalizedWorkDir, normalizedWorkDir == null);

            if (!Info.IsBare)
                index = new Index(this);

            commits = new CommitCollection(this);
            refs = new ReferenceCollection(this);
            branches = new BranchCollection(this);
            tags = new TagCollection(this);
        }