private static string GetFetchArgs(string remote, string remoteBranch, string localBranch)
{
remote = FixPath(remote);
//Remove spaces...
if (remoteBranch != null)
remoteBranch = remoteBranch.Replace(" ", "");
if (localBranch != null)
localBranch = localBranch.Replace(" ", "");
string remoteBranchArguments;
if (string.IsNullOrEmpty(remoteBranch))
remoteBranchArguments = "";
else
remoteBranchArguments = "+refs/heads/" + remoteBranch + "";
string localBranchArguments;
var remoteUrl = GetSetting("remote." + remote + ".url");
if (PathIsUrl(remote) && !string.IsNullOrEmpty(localBranch) && string.IsNullOrEmpty(remoteUrl))
localBranchArguments = ":refs/heads/" + localBranch + "";
else if (string.IsNullOrEmpty(localBranch) || PathIsUrl(remote) || string.IsNullOrEmpty(remoteUrl))
localBranchArguments = "";
else
localBranchArguments = ":" + "refs/remotes/" + remote.Trim() + "/" + localBranch + "";
var progressOption = "";
if (VersionInUse.FetchCanAskForProgress)
progressOption = "--progress ";
return progressOption + "\"" + remote.Trim() + "\" " + remoteBranchArguments + localBranchArguments;
}