Beispiel #1
0
        /// <summary>
        /// Checkout this commit into the given directory. Does not reset HEAD!
        ///
        /// Note: do not confuse this with Branch.Checkout. Commit.Checkout( path)  is for exporting the tree of a commit into a directory.
        /// </summary>
        /// <param name="working_directory">The directory to put the sources into</param>
        public void Checkout(string working_directory)
        {
            if (InternalCommit == null)
            {
                throw new InvalidOperationException("Unable to checkout this commit. It was not initialized properly (i.e. the hash is not pointing to a commit object).");
            }
            if (working_directory == null)
            {
                throw new ArgumentException("Path to checkout directory must not be null");
            }
            if (new DirectoryInfo(working_directory).Exists == false)
            {
                throw new IOException("Cannot checkout into non-existent directory: " + working_directory);
            }
            var db    = _repo._internal_repo;
            var index = _repo.Index.GitIndex;

            index.RereadIfNecessary();
            CoreTree tree = InternalCommit.TreeEntry;
            var      co   = new GitSharp.Core.WorkDirCheckout(db, new DirectoryInfo(working_directory), index, tree);

            co.checkout();
        }
Beispiel #2
0
 internal Tree(Repository repo, CoreTree tree)
     : base(repo, tree.Id)
 {
     _internal_tree = tree;
 }
Beispiel #3
0
 internal Tree(Repository repo, CoreTree tree)
     : base(repo, tree.Id)
 {
     _internal_tree = tree;
 }