GitSharp.Core.Repository.getAllRefsByPeeledObjectId C# (CSharp) Method

getAllRefsByPeeledObjectId() public method

public getAllRefsByPeeledObjectId ( ) : List>.Dictionary
return List>.Dictionary
        public Dictionary<AnyObjectId, List<Ref>> getAllRefsByPeeledObjectId()
        {
            Dictionary<String, Ref> allRefs = getAllRefs();
            var ret = new Dictionary<AnyObjectId, List<Ref>>(allRefs.Count);
            foreach (Ref @ref in allRefs.Values)
            {
                Ref ref2 = @ref;
                if (!ref2.Peeled)
                    ref2 = Peel(ref2);
                AnyObjectId target = ref2.PeeledObjectId;
                if (target == null)
                    target = ref2.ObjectId;
                // We assume most Sets here are singletons
                List<Ref> oset = ret.put(target, new List<Ref> { ref2 });
                if (oset != null)
                {
                    // that was not the case (rare)
                    if (oset.Count == 1)
                    {
                        // Was a read-only singleton, we must copy to a new Set
                        oset = new List<Ref>(oset);
                    }
                    ret.put(target, oset);
                    oset.Add(ref2);
                }
            }
            return ret;
        }