Beispiel #1
0
 private void deleteStaleTrackingRefs(FetchResult result, RevWalk.RevWalk walk)
 {
     Repository db = _transport.Local;
     foreach (Ref @ref in db.getAllRefs().Values)
     {
         string refname = @ref.Name;
         foreach (RefSpec spec in _toFetch)
         {
             if (spec.MatchDestination(refname))
             {
                 RefSpec s = spec.ExpandFromDestination(refname);
                 if (result.GetAdvertisedRef(s.Source) == null)
                 {
                     deleteTrackingRef(result, db, walk, s, @ref);
                 }
             }
         }
     }
 }
Beispiel #2
0
 private static Ref guessHEAD(FetchResult result)
 {
     Ref idHEAD = result.GetAdvertisedRef(Constants.HEAD);
     List<Ref> availableRefs = new List<Ref>();
     Ref head = null;
     foreach (Ref r in result.AdvertisedRefs.Values)
     {
         string n = r.Name;
         if (!n.StartsWith(Constants.R_HEADS))
             continue;
         availableRefs.Add(r);
         if (idHEAD == null || head != null)
             continue;
         if (r.ObjectId.Equals(idHEAD.ObjectId))
             head = r;
     }
     availableRefs.Sort(RefComparator.INSTANCE);
     if (idHEAD != null && head == null)
         head = idHEAD;
     return head;
 }