CreateBranch() public static method

public static CreateBranch ( string branchName ) : void
branchName string
return void
    void OnGUI()
    {
        bool  branchTaken  = false;
        Color defaultColor = GUI.contentColor;
        bool  enterPressed = (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Return)? true : false;

        GUILayout.Label("Enter a name for the new branch:");

        newBranchName = EditorGUILayout.TextField(newBranchName);

        checkoutAfterCreation = GUILayout.Toggle(checkoutAfterCreation, "Checkout");

        // Make sure we don't already have that branch
        foreach (string branch in existingBranches)
        {
            if (branch == newBranchName)
            {
                branchTaken = true;
                break;
            }
        }

        GUI.contentColor = Color.red;

        if (branchTaken)
        {
            GUILayout.Label("You already have a branch with that name!");
        }
        else
        {
            GUILayout.Label("");
        }

        GUI.contentColor = defaultColor;

        if (enterPressed || GUILayout.Button("Create Branch", GUILayout.MaxWidth(100)))
        {
            if (!branchTaken)
            {
                GitSystem.CreateBranch(Regex.Replace(newBranchName, @"\s", "_"), checkoutAfterCreation);
                Close();
            }
        }
    }