/// <summary>Update locally stored tracking branch with the new object.</summary> /// <remarks>Update locally stored tracking branch with the new object.</remarks> /// <param name="walk">walker used for checking update properties.</param> /// <exception cref="System.IO.IOException">when I/O error occurred during update</exception> protected internal virtual void UpdateTrackingRef(RevWalk walk) { if (IsDelete()) { trackingRefUpdate.Delete(walk); } else { trackingRefUpdate.Update(walk); } }
/// <exception cref="NGit.Errors.TransportException"></exception> private void DeleteTrackingRef(FetchResult result, Repository db, RevWalk walk, RefSpec spec, Ref localRef) { string name = localRef.GetName(); try { TrackingRefUpdate u = new TrackingRefUpdate(db, name, spec.GetSource(), true, ObjectId .ZeroId, "deleted"); result.Add(u); if (transport.IsDryRun()) { return; } u.Delete(walk); switch (u.GetResult()) { case RefUpdate.Result.NEW: case RefUpdate.Result.NO_CHANGE: case RefUpdate.Result.FAST_FORWARD: case RefUpdate.Result.FORCED: { break; } default: { throw new TransportException(transport.GetURI(), MessageFormat.Format(JGitText.Get ().cannotDeleteStaleTrackingRef2, name, u.GetResult().ToString())); } } } catch (IOException e) { throw new TransportException(transport.GetURI(), MessageFormat.Format(JGitText.Get ().cannotDeleteStaleTrackingRef, name), e); } }