Exemplo n.º 1
0
        void Remove(List <Stash> stashes, Stash s)
        {
            int i = stashes.FindIndex(st => st.CommitId == s.CommitId);

            if (i != -1)
            {
                stashes.RemoveAt(i);
                Stash next = stashes.FirstOrDefault(ns => ns.PrevStashCommitId == s.CommitId);
                if (next != null)
                {
                    next.PrevStashCommitId = s.PrevStashCommitId;
                }
                if (stashes.Count == 0)
                {
                    // No more stashes. The ref and log files can be deleted.
                    StashRefFile.Delete();
                    StashLogFile.Delete();
                    return;
                }
                WriteStashes(stashes);
                if (i == stashes.Count)
                {
                    // We deleted the head. Write the new head.
                    File.WriteAllText(StashRefFile.FullName, stashes.Last().CommitId + "\n");
                }
            }
        }
Exemplo n.º 2
0
 public void Clear()
 {
     if (StashRefFile.Exists)
     {
         StashRefFile.Delete();
     }
     if (StashLogFile.Exists)
     {
         StashLogFile.Delete();
     }
 }