private void DeleteTrackingRef(FetchResult result, BatchRefUpdate batch, RefSpec spec, Ref localRef) { if (localRef.GetObjectId() == null) { return; } TrackingRefUpdate update = new TrackingRefUpdate(true, spec.GetSource(), localRef .GetName(), localRef.GetObjectId(), ObjectId.ZeroId); result.Add(update); batch.AddCommand(update.AsReceiveCommand()); }
private static string GetFirstFailedRefName(BatchRefUpdate batch) { foreach (ReceiveCommand cmd in batch.GetCommands()) { if (cmd.GetResult() != ReceiveCommand.Result.OK) { return cmd.GetRefName(); } } return string.Empty; }
/// <exception cref="System.IO.IOException"></exception> private void DeleteStaleTrackingRefs(FetchResult result, BatchRefUpdate batch) { foreach (Ref @ref in LocalRefs().Values) { string refname = @ref.GetName(); foreach (RefSpec spec in toFetch) { if (spec.MatchDestination(refname)) { RefSpec s = spec.ExpandFromDestination(refname); if (result.GetAdvertisedRef(s.GetSource()) == null) { DeleteTrackingRef(result, batch, s, @ref); } } } } }