Skip to content

Commit

Permalink
fixup! Comment for status update
Browse files Browse the repository at this point in the history
  • Loading branch information
gerhardol committed May 18, 2020
1 parent 6962fa2 commit a8d832f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions GitCommands/Submodules/SubmoduleStatusProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public async Task UpdateSubmodulesStructureAsync(string workingDirectory, string
var currentModule = new GitModule(workingDirectory);
var result = new SubmoduleInfoResult { Module = currentModule };

// Add all submodules inside the current repository:
// Add all submodules inside the current repository
GetSuperProjectRepositorySubmodulesStructure(currentModule, result, noBranchText);
SetOurSubmoduleData(currentModule, result);

Expand All @@ -100,14 +100,14 @@ public async Task UpdateSubmodulesStructureAsync(string workingDirectory, string
// Structure is updated
OnStatusUpdated(result, cancelToken);

if (updateStatus)
if (updateStatus && currentModule.SuperprojectModule != null)
{
// Update status below top module (but not the top module itself), stop at current module (that is handled by git-status)
// For the topmodule, use git-status information to update the status
// If a submodule is current update for all submodules to give an overview
// The structure below the current module could have been updated from git-status but the current module
// must be updated from its superproject to set the ahead/behind information (once, as the super project info)
// Further git-status updates only the current module and below
var info = _submoduleInfos[workingDirectory];
_submoduleInfos[workingDirectory] = null;
await GetSubmoduleDetailedStatusAsync(currentModule.GetTopModule(), cancelToken);
_submoduleInfos[workingDirectory] = info;
}

_submoduleInfoResult = result;
Expand Down Expand Up @@ -331,9 +331,10 @@ private async Task UpdateSubmodulesStatusAsync(GitModule module, [CanBeNull] IRe
// (changed commit can be missed, but top module can only be dirty)
SetModuleAsDirtyUpwards(module);
}
else
else if (_submoduleInfos[module.WorkingDir].Detailed != null && _submoduleInfos[module.WorkingDir].Detailed.Status == SubmoduleStatus.Unknown)
{
// No Git changes for this module, clear status (but unknown for super projects)
// To clear ahead/behind requires call from a super project
_submoduleInfos[module.WorkingDir].Detailed = null;
}

Expand Down
2 changes: 1 addition & 1 deletion GitUI/CommandsDialogs/FormBrowse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2577,7 +2577,7 @@ Image GetSubmoduleItemImage(DetailedSubmoduleInfo details)
private void UpdateSubmodulesStructure()
{
// Submodule status is updated on git-status updates. To make sure supermodule status is updated, update immediately (once)
var updateStatus = AppSettings.ShowSubmoduleStatus && _gitStatusMonitor.Active && (Module.SuperprojectModule != null);
var updateStatus = AppSettings.ShowSubmoduleStatus && _gitStatusMonitor.Active;

toolStripButtonLevelUp.ToolTipText = "";

Expand Down

0 comments on commit a8d832f

Please sign in to comment.