A Commit references a tree which is a copy of the working directory
Inheritance: GitObject
Example #1
0
        internal override void Deserialize()
        {
            if (!Utility.IsValidSHA(SHA))
                throw new ArgumentException("Need valid sha", "contents");

            _commit = Repo.Storage.GetObject<Commit>(SHA);
        }
Example #2
0
 private void WalkHistory(Commit commit)
 {
     if (commit.HasParents)
     {
         foreach(Commit parent in commit.Parents)
             WalkHistory(parent);
     }
 }
Example #3
0
 //private void SelectConfiguration(object obj)
 //{
 //    if (obj is Entry)
 //    {
 //        var entry = obj as dotGit.Config.Entry;
 //        m_config_name.Content = entry.FullName;
 //        if (entry.Value != null)
 //            m_config_value.Text = entry.Value;
 //    }
 //}
 private void DisplayCommit(Commit commit, string info)
 {
     if (commit == null)
         return;
     var list = commit.Ancestors.ToList();
     list.Insert(0, commit);
     m_commits.ItemsSource = list;
     m_commits.SelectedIndex = 0;
     m_commit_title.Text = "Commit history for " + info;
 }
Example #4
0
        private Commit _commit = null; // Will only be set if HEAD is detached

        #endregion Fields

        #region Constructors

        internal Head(Repository repo)
        {
            Repo = repo;

            string headContents = File.ReadAllText(Path.Combine(Repo.GitDir.FullName, @"HEAD")).Trim();

            if (!Utility.IsValidSHA(headContents))
            { // HEAD content does not contain valid SHA. Will assume format: 'refs: path/to/ref'

                string path = headContents.Split(' ').Last().Replace('/', Path.DirectorySeparatorChar).Trim();

                Branch = Repo.Branches[Path.GetFileName(path)];
            }
            else
            {
                _commit = Repo.Storage.GetObject<Commit>(headContents);
            }
        }
Example #5
0
 private void SelectCommit(Commit commit)
 {
     if (commit == null)
         return;
     m_tree.ItemsSource = commit.Tree.Children;
     m_tree_title.Text = "Repository tree of Commit " + commit.SHA;
     //(m_tree.ItemContainerGenerator.ContainerFromIndex(0) as TreeViewItem).IsExpanded = true;
 }
Example #6
0
 private static void GetAncestorsRecursive(Commit commit, HashSet<Commit> ancestors)
 {
     if (commit.Parents == null)
       return;
       foreach (var parent in commit.Parents)
       {
       if (ancestors.Contains(parent))
           continue;
       ancestors.Add(parent);
       GetAncestorsRecursive(parent, ancestors);
       }
 }
Example #7
0
 /// <summary>
 /// Compares commit to other commit on SHA
 /// </summary>
 /// <param name="obj">The other commit to compare with</param>
 /// <returns>Boolean indicating this object is equal to <paramref name="obj"/></returns>
 public bool Equals(Commit c)
 {
     return String.Equals(c.SHA, SHA);
 }