/// <summary>Create a new hook chaining the given hooks together.</summary> /// <remarks>Create a new hook chaining the given hooks together.</remarks> /// <param name="hooks">hooks to execute, in order.</param> /// <returns>a new hook chain of the given hooks.</returns> public static PreReceiveHook NewChain <_T0>(IList <_T0> hooks) where _T0 : PreReceiveHook { PreReceiveHook[] newHooks = new PreReceiveHook[hooks.Count]; int i = 0; foreach (PreReceiveHook hook in hooks) { if (hook != PreReceiveHook.NULL) { newHooks[i++] = hook; } } if (i == 0) { return(PreReceiveHook.NULL); } else { if (i == 1) { return(newHooks[0]); } else { return(new NGit.Transport.PreReceiveHookChain(newHooks, i)); } } }
/// <summary>Set the hook which is invoked prior to commands being executed.</summary> /// <remarks> /// Set the hook which is invoked prior to commands being executed. /// <p> /// Only valid commands (those which have no obvious errors according to the /// received input and this instance's configuration) are passed into the /// hook. The hook may mark a command with a result of any value other than /// <see cref="Result.NOT_ATTEMPTED">Result.NOT_ATTEMPTED</see> /// to block its execution. /// <p> /// The hook may be called with an empty command collection if the current /// set is completely invalid. /// </remarks> /// <param name="h">the hook instance; may be null to disable the hook.</param> public virtual void SetPreReceiveHook(PreReceiveHook h) { preReceive = h != null ? h : PreReceiveHook.NULL; }
/// <summary>Create a new pack receive for an open repository.</summary> /// <remarks>Create a new pack receive for an open repository.</remarks> /// <param name="into">the destination repository.</param> protected internal ReceivePack(Repository into) : base(into) { preReceive = PreReceiveHook.NULL; postReceive = PostReceiveHook.NULL; }
/// <summary>Create a new pack receive for an open repository.</summary> /// <remarks>Create a new pack receive for an open repository.</remarks> /// <param name="into">the destination repository.</param> public ReceivePack(Repository into) : base(into) { preReceive = PreReceiveHook.NULL; postReceive = PostReceiveHook.NULL; }