GitCommands.GitModule.PushAllCmd C# (CSharp) Method

PushAllCmd() public method

Creates a 'git push' command using the specified parameters.
public PushAllCmd ( string remote, ForcePushOptions force, bool track, int recursiveSubmodules ) : string
remote string Remote repository that is the destination of the push operation.
force ForcePushOptions If a remote ref is not an ancestor of the local ref, overwrite it. /// This can cause the remote repository to lose commits; use it with care.
track bool For every branch that is up to date or successfully pushed, add upstream (tracking) reference.
recursiveSubmodules int If '1', check whether all submodule commits used by the revisions to be pushed are available on a remote tracking branch; otherwise, the push will be aborted.
return string
        public string PushAllCmd(string remote, ForcePushOptions force, bool track, int recursiveSubmodules)
        {
            remote = remote.ToPosixPath();

            var sforce = GitCommandHelpers.GetForcePushArgument(force);

            var strack = "";
            if (track)
                strack = "-u ";

            var srecursiveSubmodules = "";
            if (recursiveSubmodules == 1)
                srecursiveSubmodules = "--recurse-submodules=check ";
            if (recursiveSubmodules == 2)
                srecursiveSubmodules = "--recurse-submodules=on-demand ";

            var sprogressOption = "";
            if (GitCommandHelpers.VersionInUse.PushCanAskForProgress)
                sprogressOption = "--progress ";

            var options = String.Concat(sforce, strack, srecursiveSubmodules, sprogressOption);
            return String.Format("push {0}--all \"{1}\"", options, remote.Trim());
        }
GitModule