Exemple #1
0
        protected void OnMergeComplete(MergeResult result, string mergeType)
        {
            switch (result.Status)
            {
            case MergeStatus.UpToDate:
                GitHistoryWindow.GetWindow(true).ShowNotification(new GUIContent(string.Format("Everything is Up to date. Nothing to {0}.", mergeType)));
                break;

            case MergeStatus.FastForward:
                GitHistoryWindow.GetWindow(true).ShowNotification(new GUIContent(mergeType + " Complete with Fast Forwarding."));
                break;

            case MergeStatus.NonFastForward:
                GitDiffWindow.GetWindow(true).ShowNotification(new GUIContent("Do a merge commit in order to push changes."));
                GitDiffWindow.GetWindow(false).commitMessage = GitManager.Repository.Info.Message;
                Debug.Log(mergeType + " Complete without Fast Forwarding.");
                break;

            case MergeStatus.Conflicts:
                GUIContent content = EditorGUIUtility.IconContent("console.warnicon");
                content.text = "There are merge conflicts!";
                GitDiffWindow.GetWindow(true).ShowNotification(content);
                GitDiffWindow.GetWindow(false).commitMessage = GitManager.Repository.Info.Message;
                break;
            }
            GitManager.Update();
            Debug.LogFormat("{0} Status: {1}", mergeType, result.Status);
        }
 private void CommitCallback(GitDiffWindow window)
 {
     if (EditorUtility.DisplayDialog("Are you sure?", "Are you sure you want to commit the changes?", "✔ Commit", "✖ Cancel"))
     {
         window.Commit();
     }
 }
 private void BuildCommitMenu(GenericMenu commitMenu, GitDiffWindow window)
 {
     if (gitManager == null)
     {
         return;
     }
     commitMenu.AddItem(new GUIContent("✔ Commit"), false, () => CommitCallback(window));
     if (!gitSettings.ExternalsType.IsFlagSet(GitSettingsJson.ExternalsTypeEnum.Commit))
     {
         commitMenu.AddItem(new GUIContent("➔ Commit And Push"), false, () => CommitAndPushCallback(window));
     }
     else
     {
         commitMenu.AddDisabledItem(new GUIContent("✔ Commit And Push"));
     }
     commitMenu.AddSeparator("");
     commitMenu.AddItem(new GUIContent("Commit Message/✖ Clear"), false, window.ClearCommitMessage);
     commitMenu.AddItem(new GUIContent("Commit Message/📖 Read from file"), gitSettings.ReadFromFile, () => ToggleReadFromFile(window));
     if (File.Exists(initializer.GetCommitMessageFilePath(gitSettings.ActiveSubModule)))
     {
         commitMenu.AddItem(new GUIContent("Commit Message/✎ Open File"), false, OpenCommitMessageFile);
     }
     else
     {
         commitMenu.AddDisabledItem(new GUIContent("Commit Message/⤷ Open File"));
     }
     commitMenu.AddItem(new GUIContent("Commit Message/♺ Reload"), false, window.ReadCommitMessage);
 }
 private void CommitAndPushCallback(GitDiffWindow window)
 {
     if (gitSettings.ExternalsType.IsFlagSet(GitSettingsJson.ExternalsTypeEnum.Commit) || EditorUtility.DisplayDialog("Are you sure?", "Are you sure you want to commit the changes and then push them?", "➔ Commit and Push", "✖ Cancel"))
     {
         if (window.Commit())
         {
             UniGitLoader.DisplayWizard <GitPushWizard>("Git Push", "Push");
         }
     }
 }
Exemple #5
0
 private void RemoveSelectedCallback(GitDiffWindow window)
 {
     string[] localPaths = window.GetStatusList().Where(window.IsSelected).SelectMany(e => gitManager.GetPathWithMeta(e.LocalPath)).ToArray();
     if (gitManager.Threading.IsFlagSet(GitSettingsJson.ThreadingType.Unstage))
     {
         gitManager.AsyncUnstage(localPaths).onComplete += (o) => { window.Repaint(); };
     }
     else
     {
         GitCommands.Unstage(gitManager.Repository, localPaths);
         gitManager.MarkDirtyAuto(localPaths);
     }
     window.Repaint();
 }
Exemple #6
0
 private void SelectFilteredCallback(FileStatus filter, GitDiffWindow window)
 {
     foreach (var entry in window.GetStatusList())
     {
         if (entry.State == filter)
         {
             window.AddSelected(entry);
         }
         else
         {
             window.RemoveSelected(entry);
         }
     }
 }
Exemple #7
0
        protected void OnMergeComplete(MergeResult result, string mergeType)
        {
            var historyWindow = UniGitLoader.FindWindow <GitHistoryWindow>();
            var diffWindow    = UniGitLoader.FindWindow <GitDiffWindow>();

            switch (result.Status)
            {
            case MergeStatus.UpToDate:
                if (historyWindow != null)
                {
                    historyWindow.ShowNotification(new GUIContent(string.Format("Everything is Up to date. Nothing to {0}.", mergeType)));
                }
                break;

            case MergeStatus.FastForward:
                if (historyWindow != null)
                {
                    historyWindow.ShowNotification(new GUIContent(mergeType + " Complete with Fast Forwarding."));
                }
                break;

            case MergeStatus.NonFastForward:
                if (diffWindow != null)
                {
                    diffWindow.ShowNotification(new GUIContent("Do a merge commit in order to push changes."));
                    diffWindow.SetCommitMessage(gitManager.Repository.Info.Message);
                }
                else
                {
                    GitDiffWindow.SetCommitMessage(gitManager, gitManager.Repository.Info.Message);
                }
                Debug.Log(mergeType + " Complete without Fast Forwarding.");
                break;

            case MergeStatus.Conflicts:
                GUIContent content = GitGUI.IconContent("console.warnicon", "There are merge conflicts!");
                if (diffWindow != null)
                {
                    diffWindow.ShowNotification(content);
                    diffWindow.SetCommitMessage(gitManager.Repository.Info.Message);
                }
                else
                {
                    GitDiffWindow.SetCommitMessage(gitManager, gitManager.Repository.Info.Message);
                }
                break;
            }
            gitManager.MarkDirty();
            Debug.LogFormat("{0} Status: {1}", mergeType, result.Status);
        }
        private void ToggleReadFromFile(GitDiffWindow window)
        {
            if (gitSettings.ReadFromFile)
            {
                gitSettings.ReadFromFile = false;
                window.ReadCommitMessage();
            }
            else
            {
                gitSettings.ReadFromFile = true;
                window.ReadCommitMessageFromFile();
            }

            gitSettings.MarkDirty();
        }
Exemple #9
0
        internal void Build(FileStatus fileStatus, GenericMenu menu, GitDiffWindow window)
        {
            menu.AddItem(new GUIContent("Select All"), false, () => SelectFilteredCallback(fileStatus, window));
            if (GitManager.CanStage(fileStatus))
            {
                menu.AddItem(new GUIContent("Add All"), false, () =>
                {
                    string[] paths = window.GetStatusList().Where(s => s.State.IsFlagSet(fileStatus)).SelectMany(s => gitManager.GetPathWithMeta(s.LocalPath)).ToArray();
                    if (gitManager.Threading.IsFlagSet(GitSettingsJson.ThreadingType.Stage))
                    {
                        gitManager.AsyncStage(paths).onComplete += (o) => { window.Repaint(); };
                    }
                    else
                    {
                        GitCommands.Stage(gitManager.Repository, paths);
                        gitManager.MarkDirtyAuto(paths);
                    }
                    window.Repaint();
                });
            }
            else
            {
                menu.AddDisabledItem(new GUIContent("Add All"));
            }

            if (GitManager.CanUnstage(fileStatus))
            {
                menu.AddItem(new GUIContent("Remove All"), false, () =>
                {
                    string[] paths = window.GetStatusList().Where(s => s.State.IsFlagSet(fileStatus)).SelectMany(s => gitManager.GetPathWithMeta(s.LocalPath)).ToArray();
                    if (gitManager.Threading.IsFlagSet(GitSettingsJson.ThreadingType.Unstage))
                    {
                        gitManager.AsyncUnstage(paths).onComplete += (o) => { window.Repaint(); };
                    }
                    else
                    {
                        GitCommands.Unstage(gitManager.Repository, paths);
                        gitManager.MarkDirtyAuto(paths);
                    }
                    window.Repaint();
                });
            }
            else
            {
                menu.AddDisabledItem(new GUIContent("Remove All"));
            }
        }
Exemple #10
0
        internal void Build(IGenericMenu editMenu, GitDiffWindow window)
        {
            StatusListEntry[] entries       = window.GetStatusList().Where(window.IsSelected).ToArray();
            FileStatus        selectedFlags = entries.Select(e => e.State).CombineFlags();

            GUIContent addContent = new GUIContent("Stage", GitGUI.Textures.CollabPush);

            if (GitManager.CanStage(selectedFlags))
            {
                editMenu.AddItem(addContent, false, () => { AddSelectedCallback(window); });
            }
            else
            {
                editMenu.AddDisabledItem(addContent);
            }
            GUIContent removeContent = new GUIContent("Unstage", GitGUI.Textures.CollabPull);

            if (GitManager.CanUnstage(selectedFlags))
            {
                editMenu.AddItem(removeContent, false, () => { RemoveSelectedCallback(window); });
            }
            else
            {
                editMenu.AddDisabledItem(removeContent);
            }

            editMenu.AddSeparator("");
            Texture2D diffIcon = GitGUI.Textures.ZoomTool;

            if (entries.Length >= 1)
            {
                string localPath = entries[0].LocalPath;
                if (selectedFlags.IsFlagSet(FileStatus.Conflicted))
                {
                    if (conflictsHandler.CanResolveConflictsWithTool(localPath))
                    {
                        editMenu.AddItem(new GUIContent("Resolve Conflicts", "Resolve merge conflicts"), false, ResolveConflictsCallback, localPath);
                    }
                    else
                    {
                        editMenu.AddDisabledItem(new GUIContent("Resolve Conflicts"));
                    }
                    editMenu.AddItem(new GUIContent("Resolve (Using Ours)"), false, ResolveConflictsOursCallback, localPath);
                    editMenu.AddItem(new GUIContent("Resolve (Using Theirs)"), false, ResolveConflictsTheirsCallback, localPath);
                }
                else if (!selectedFlags.IsFlagSet(FileStatus.Ignored))
                {
                    if (entries[0].MetaChange == (MetaChangeEnum.Object | MetaChangeEnum.Meta))
                    {
                        editMenu.AddItem(new GUIContent("Difference/Asset", diffIcon), false, () => { SeeDifferenceObject(entries[0]); });
                        editMenu.AddItem(new GUIContent("Difference/Meta", diffIcon), false, () => { SeeDifferenceMeta(entries[0]); });
                    }
                    else
                    {
                        editMenu.AddItem(new GUIContent("Difference", diffIcon), false, () => { SeeDifferenceAuto(entries[0]); });
                    }

                    if (entries[0].MetaChange == (MetaChangeEnum.Object | MetaChangeEnum.Meta))
                    {
                        editMenu.AddItem(new GUIContent("Difference with previous version/Asset", diffIcon), false, () => { SeeDifferencePrevObject(entries[0]); });
                        editMenu.AddItem(new GUIContent("Difference with previous version/Meta", diffIcon), false, () => { SeeDifferencePrevMeta(entries[0]); });
                    }
                    else
                    {
                        editMenu.AddItem(new GUIContent("Difference with previous version", diffIcon), false, () => { SeeDifferencePrevAuto(entries[0]); });
                    }
                }
                else
                {
                    editMenu.AddDisabledItem(new GUIContent("Difference", diffIcon));
                    editMenu.AddDisabledItem(new GUIContent("Difference with previous version", diffIcon));
                }
                editMenu.AddSeparator("");
            }

            if (selectedFlags.IsFlagSet(FileStatus.Ignored))
            {
                editMenu.AddDisabledItem(new GUIContent("Revert", GitGUI.Textures.AnimationWindow));
            }
            else if (entries.Length >= 1)
            {
                if (entries[0].MetaChange == (MetaChangeEnum.Object | MetaChangeEnum.Meta))
                {
                    editMenu.AddItem(new GUIContent("Revert/Asset", GitGUI.Textures.AnimationWindow), false, () => RevertSelectedObjects(window));
                    editMenu.AddItem(new GUIContent("Revert/Meta", GitGUI.Textures.AnimationWindow), false, () => RevertSelectedMeta(window));
                }
                else
                {
                    editMenu.AddItem(new GUIContent("Revert", GitGUI.Textures.AnimationWindow), false, () => RevertSelectedCallback(window));
                }
            }

            if (entries.Length >= 1)
            {
                editMenu.AddSeparator("");
                if (entries[0].MetaChange == (MetaChangeEnum.Object | MetaChangeEnum.Meta))
                {
                    if (gitManager.CanBlame(entries[0].State))
                    {
                        editMenu.AddItem(new GUIContent("Blame/Object", GitGUI.Textures.GameView), false, () => { BlameObject(entries[0]); });
                        editMenu.AddItem(new GUIContent("Blame/Meta", GitGUI.Textures.GameView), false, () => { BlameMeta(entries[0]); });
                    }
                    else
                    {
                        editMenu.AddDisabledItem(new GUIContent("Blame", GitGUI.Textures.GameView));
                    }
                }
                else if (entries.Length > 0)
                {
                    if (gitManager.CanBlame(entries[0].State))
                    {
                        editMenu.AddItem(new GUIContent("Blame", GitGUI.Textures.GameView), false, () => { BlameAuto(entries[0]); });
                    }
                    else
                    {
                        editMenu.AddDisabledItem(new GUIContent("Blame", GitGUI.Textures.GameView));
                    }
                }
            }
            editMenu.AddSeparator("");
            if (entries.Length >= 1)
            {
                editMenu.AddItem(new GUIContent("Show In Explorer", GitGUI.Textures.FolderIcon), false, () => { EditorUtility.RevealInFinder(gitManager.ToProjectPath(entries[0].LocalPath)); });
            }
            editMenu.AddItem(new GUIContent("Open", GitGUI.Textures.OrbitTool), false, () =>
            {
                AssetDatabase.OpenAsset(entries.Select(e => AssetDatabase.LoadAssetAtPath <Object>(gitManager.ToProjectPath(e.LocalPath))).Where(a => a != null).ToArray());
            });
            editMenu.AddItem(new GUIContent("Delete", gitOverlay.icons.trashIconSmall.image), false, () =>
            {
                foreach (var entry in entries)
                {
                    window.DeleteAsset(entry.LocalPath);
                }
            });
            editMenu.AddItem(new GUIContent("Reload", GitGUI.Textures.RotateTool), false, window.ReloadCallback);
        }
Exemple #11
0
 private void RevertSelectedObjects(GitDiffWindow window)
 {
     string[] localPaths = window.GetStatusList().Where(window.IsSelected).Select(e => e.LocalPath).SkipWhile(gitManager.IsDirectory).ToArray();
     Revert(localPaths);
 }
Exemple #12
0
 private void RevertSelectedMeta(GitDiffWindow window)
 {
     string[] metaLocalPaths = window.GetStatusList().Where(window.IsSelected).Select(e => GitManager.MetaPathFromAsset(e.LocalPath)).ToArray();
     Revert(metaLocalPaths);
 }
Exemple #13
0
 private void RevertSelectedCallback(GitDiffWindow window)
 {
     string[] localPaths = window.GetStatusList().Where(window.IsSelected).SelectMany(e => gitManager.GetPathWithMeta(e.LocalPath)).ToArray();
     Revert(localPaths);
 }
        internal void DoCommit(RepositoryInformation repoInfo, GitDiffWindow window, ref Vector2 commitScroll)
        {
            var settings = window.GitDiffSettings;

            EditorGUILayout.Space();
            EditorGUILayout.BeginHorizontal();
            if (repoInfo.CurrentOperation == CurrentOperation.Merge)
            {
                GUILayout.Label(GitGUI.GetTempContent("Merge"), styles.mergeIndicator);
            }
            window.CommitMaximized = GUILayout.Toggle(window.CommitMaximized, GitGUI.GetTempContent(gitSettings.ReadFromFile ? "File Commit Message: (Read Only)" : "Commit Message: "), styles.commitMessageFoldoud, GUILayout.Width(gitSettings.ReadFromFile ? 210 : 116));
            EditorGUI.BeginDisabledGroup(true);
            if (!window.CommitMaximized)
            {
                if (!gitSettings.ReadFromFile)
                {
                    EditorGUI.BeginChangeCheck();
                    GUI.SetNextControlName("Commit Message Field");
                    settings.commitMessage = EditorGUILayout.TextArea(settings.commitMessage, GUILayout.Height(EditorGUIUtility.singleLineHeight));
                    if (EditorGUI.EndChangeCheck())
                    {
                        window.SaveCommitMessage();
                    }
                }
                else
                {
                    GUILayout.Label(GitGUI.GetTempContent(settings.commitMessageFromFile), GUI.skin.textArea, GUILayout.Height(EditorGUIUtility.singleLineHeight));
                }
            }
            EditorGUI.EndDisabledGroup();
            EditorGUILayout.EndHorizontal();
            if (window.CommitMaximized)
            {
                commitScroll = EditorGUILayout.BeginScrollView(commitScroll, GUILayout.Height(window.CalculateCommitTextHeight()));
                if (!gitSettings.ReadFromFile)
                {
                    EditorGUI.BeginChangeCheck();
                    GUI.SetNextControlName("Commit Message Field");
                    string newCommitMessage = EditorGUILayout.TextArea(settings.commitMessage, GUILayout.ExpandHeight(true));
                    if (EditorGUI.EndChangeCheck())
                    {
                        if ((Event.current.character == ' ' || Event.current.character == '\0') && !(commitMessageLastChar == ' ' || commitMessageLastChar == '\0'))
                        {
                            if (Undo.GetCurrentGroupName() == GitDiffWindow.CommitMessageUndoGroup)
                            {
                                Undo.IncrementCurrentGroup();
                            }
                        }
                        commitMessageLastChar = Event.current.character;
                        Undo.RecordObject(window, GitDiffWindow.CommitMessageUndoGroup);
                        settings.commitMessage = newCommitMessage;
                        window.SaveCommitMessage();
                    }
                }
                else
                {
                    GUILayout.Label(GitGUI.GetTempContent(settings.commitMessageFromFile), GUI.skin.textArea, GUILayout.ExpandHeight(true));
                }
                EditorGUILayout.EndScrollView();
            }

            EditorGUILayout.BeginHorizontal();

            if (GUILayout.Button(GitGUI.GetTempContent("Commit"), styles.commitButton))
            {
                GenericMenu commitMenu = new GenericMenu();
                BuildCommitMenu(commitMenu, window);
                commitMenu.ShowAsContext();
            }
            GitGUI.StartEnable(!gitSettings.ExternalsType.IsFlagSet(GitSettingsJson.ExternalsTypeEnum.Commit));
            settings.emptyCommit = GUILayout.Toggle(settings.emptyCommit, GitGUI.GetTempContent("Empty Commit", "Commit the message only without changes"));
            EditorGUI.BeginChangeCheck();
            settings.amendCommit = GUILayout.Toggle(settings.amendCommit, GitGUI.GetTempContent("Amend Commit", "Amend previous commit."));
            if (EditorGUI.EndChangeCheck())
            {
                if (settings.amendCommit)
                {
                    window.AmmendCommit();
                }
            }
            settings.prettify = GUILayout.Toggle(settings.prettify, GitGUI.GetTempContent("Prettify", "Prettify the commit message"));
            GitGUI.EndEnable();
            GUILayout.FlexibleSpace();
            if (GitGUI.LinkButtonLayout(gitOverlay.icons.donateSmall, GitGUI.Styles.IconButton))
            {
                GitLinks.GoTo(GitLinks.Donate);
            }
            if (GitGUI.LinkButtonLayout(GitGUI.Contents.Help, GitGUI.Styles.IconButton))
            {
                GitLinks.GoTo(GitLinks.DiffWindowHelp);
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Space();
        }
Exemple #15
0
 public GitDiffWindowSorter(GitDiffWindow window, GitManager gitManager)
 {
     this.window     = window;
     this.gitManager = gitManager;
 }
        internal void DoDiffToolbar(Rect rect, GitDiffWindow window, ref string filter)
        {
            var settings = window.GitDiffSettings;

            GUILayout.BeginArea(rect, GUIContent.none, EditorStyles.toolbar);
            EditorGUILayout.BeginHorizontal();
            Rect btRect = GUILayoutUtility.GetRect(GitGUI.GetTempContent("Edit"), EditorStyles.toolbarDropDown, GUILayout.MinWidth(64));

            if (GUI.Button(btRect, GitGUI.GetTempContent("Edit"), EditorStyles.toolbarDropDown))
            {
                GenericMenuWrapper editMenu = new GenericMenuWrapper(new GenericMenu());
                contextFactory.Build(editMenu, window);
                editMenu.GenericMenu.DropDown(btRect);
            }
            btRect = GUILayoutUtility.GetRect(GitGUI.GetTempContent("View"), EditorStyles.toolbarDropDown, GUILayout.MinWidth(64));
            if (GUI.Button(btRect, GitGUI.GetTempContent("View"), EditorStyles.toolbarDropDown))
            {
                GenericMenuWrapper viewMenu = new GenericMenuWrapper(new GenericMenu());
                viewMenu.AddItem(new GUIContent("Small Elements"), prefs.GetBool(GitDiffWindowDiffElementRenderer.SmallElementsKey, false), () => { prefs.SetBool(GitDiffWindowDiffElementRenderer.SmallElementsKey, !prefs.GetBool(GitDiffWindowDiffElementRenderer.SmallElementsKey, false)); });
                viewMenu.GenericMenu.DropDown(btRect);
            }
            btRect = GUILayoutUtility.GetRect(GitGUI.GetTempContent("Filter"), EditorStyles.toolbarDropDown, GUILayout.MinWidth(64));
            if (GUI.Button(btRect, GitGUI.GetTempContent("Filter"), EditorStyles.toolbarDropDown))
            {
                GenericMenu  genericMenu  = new GenericMenu();
                FileStatus[] fileStatuses = (FileStatus[])Enum.GetValues(typeof(FileStatus));
                genericMenu.AddItem(new GUIContent("Show All"), settings.showFileStatusTypeFilter == (FileStatus)(-1), () =>
                {
                    settings.showFileStatusTypeFilter = (FileStatus)(-1);
                    window.UpdateStatusList();
                });
                genericMenu.AddItem(new GUIContent("Show None"), settings.showFileStatusTypeFilter == 0, () =>
                {
                    settings.showFileStatusTypeFilter = 0;
                    window.UpdateStatusList();
                });
                for (int i = 0; i < fileStatuses.Length; i++)
                {
                    FileStatus flag = fileStatuses[i];
                    genericMenu.AddItem(new GUIContent(flag.ToString()), settings.showFileStatusTypeFilter != (FileStatus)(-1) && settings.showFileStatusTypeFilter.IsFlagSet(flag), () =>
                    {
                        settings.showFileStatusTypeFilter = settings.showFileStatusTypeFilter.SetFlags(flag, !settings.showFileStatusTypeFilter.IsFlagSet(flag));
                        window.UpdateStatusList();
                    });
                }
                genericMenu.DropDown(btRect);
            }
            btRect = GUILayoutUtility.GetRect(GitGUI.GetTempContent("Sort"), EditorStyles.toolbarDropDown, GUILayout.MinWidth(64));
            if (GUI.Button(btRect, GitGUI.GetTempContent("Sort"), EditorStyles.toolbarDropDown))
            {
                GenericMenu genericMenu = new GenericMenu();
                foreach (GitDiffWindow.SortType type in Enum.GetValues(typeof(GitDiffWindow.SortType)))
                {
                    GitDiffWindow.SortType t = type;
                    genericMenu.AddItem(new GUIContent(type.GetDescription()), type == settings.sortType, () =>
                    {
                        settings.sortType = t;
                        window.UpdateStatusList();
                    });
                }
                genericMenu.AddSeparator("");
                foreach (GitDiffWindow.SortDir dir in Enum.GetValues(typeof(GitDiffWindow.SortDir)))
                {
                    GitDiffWindow.SortDir d = dir;
                    genericMenu.AddItem(new GUIContent(dir.GetDescription()), dir == settings.sortDir, () =>
                    {
                        settings.sortDir = d;
                        window.UpdateStatusList();
                    });
                }
                genericMenu.AddSeparator("");
                genericMenu.AddItem(new GUIContent("Group"), settings.merge, () =>
                {
                    settings.merge = !settings.merge;
                    window.UpdateStatusList();
                });
                genericMenu.AddItem(new GUIContent("Prioritize Unstaged Changes"), settings.unstagedChangesPriority, () =>
                {
                    settings.unstagedChangesPriority = !settings.unstagedChangesPriority;
                    window.UpdateStatusList();
                });
                genericMenu.DropDown(btRect);
            }

            GUIContent modulesContent = GitGUI.GetTempContent("Modules");

            foreach (var subModule in data.RepositoryStatus.SubModuleEntries)
            {
                if (subModule.Status == SubmoduleStatus.InConfig)
                {
                    modulesContent.image   = GitGUI.Textures.WarrningIconSmall;
                    modulesContent.tooltip = "Some modules are in config only";
                    break;
                }
                if (subModule.Status.HasFlag(SubmoduleStatus.WorkDirUninitialized))
                {
                    modulesContent.image   = GitGUI.Textures.WarrningIconSmall;
                    modulesContent.tooltip = "Uninitialized modules";
                    break;
                }
                if (subModule.Status.HasFlag(SubmoduleStatus.WorkDirModified))
                {
                    modulesContent.image = GitGUI.Textures.CollabPush;
                    break;
                }
                if (subModule.Status.HasFlag(SubmoduleStatus.WorkDirModified))
                {
                    modulesContent.image = gitOverlay.icons.modifiedIconSmall.image;
                    break;
                }
                if (subModule.Status.HasFlag(SubmoduleStatus.WorkDirFilesUntracked))
                {
                    modulesContent.image = gitOverlay.icons.untrackedIconSmall.image;
                    break;
                }
            }

            btRect = GUILayoutUtility.GetRect(modulesContent, EditorStyles.toolbarDropDown, GUILayout.MinWidth(86));
            if (GUI.Button(btRect, modulesContent, EditorStyles.toolbarDropDown))
            {
                PopupWindow.Show(btRect, injectionHelper.CreateInstance <GitSubModulesPopup>());
            }

            EditorGUILayout.Space();

            if (!gitManager.InSubModule)
            {
                GUILayout.Toggle(true, GitGUI.GetTempContent("Main"), "GUIEditor.BreadcrumbLeft", GUILayout.MinWidth(86));
            }
            else
            {
                if (GUILayout.Button(GitGUI.GetTempContent("Main"), "GUIEditor.BreadcrumbLeft", GUILayout.MinWidth(86)))
                {
                    gitManager.SwitchToMainRepository();
                }

                GUILayout.Toggle(true, GitGUI.GetTempContent(Path.GetFileName(gitSettings.ActiveSubModule), gitOverlay.icons.submoduleIconSmall.image), "GUIEditor.BreadcrumbMid", GUILayout.MinWidth(86));
            }

            bool       isUpdating       = gitManager.IsUpdating;
            bool       isStaging        = gitManager.IsAsyncStaging;
            bool       isDirty          = gitManager.IsDirty;
            bool       statusListUpdate = window.GetStatusListUpdateOperation() != null && !window.GetStatusListUpdateOperation().IsDone;
            GUIContent statusContent    = null;

            if (isUpdating)
            {
                statusContent = GitGUI.GetTempContent("Updating...", GitGUI.GetTempSpinAnimatedTexture());
            }
            else if (isStaging)
            {
                statusContent = GitGUI.GetTempContent("Staging...", GitGUI.GetTempSpinAnimatedTexture());
            }
            else if (isDirty)
            {
                string updateStatus = GetUpdateStatusMessage(gitManager.GetUpdateStatus());
                statusContent = GitGUI.GetTempContent(updateStatus + "... ", GitGUI.GetTempSpinAnimatedTexture());
            }
            else if (statusListUpdate)
            {
                statusContent = GitGUI.GetTempContent(window.GetStatusBuildingState(), GitGUI.GetTempSpinAnimatedTexture());
            }

            GUILayout.FlexibleSpace();

            if (statusContent != null)
            {
                GUILayout.Label(statusContent, EditorStyles.toolbarButton);
                if (gitSettings.AnimationType.HasFlag(GitSettingsJson.AnimationTypeEnum.Loading))
                {
                    window.Repaint();
                }
            }

            filter = searchField.OnToolbarGUI(filter);
            EditorGUILayout.EndHorizontal();
            GUILayout.EndArea();
        }