Skip to content

Commit b030f5b

Browse files
committed
Do not show explicit status for submodule folder
Fixed exception when no submodules are available.
1 parent 6e88a73 commit b030f5b

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

Editor/WiseGitIntegration.cs

+23-8
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,12 @@ static WiseGitIntegration()
303303

304304
EditorApplication.quitting += () => m_IsApplicationQuitting = true;
305305

306-
m_SubmoduleRoots = ListAllSubmodulePaths().ToList();
306+
try {
307+
m_SubmoduleRoots = ListAllSubmodulePaths().ToList();
308+
} catch(Exception ex) {
309+
Debug.LogError("WiseGit failed to obtain list of the submodules on startup.");
310+
Debug.LogException(ex);
311+
}
307312
}
308313

309314
/// <summary>
@@ -437,7 +442,14 @@ public static StatusOperationResult GetStatuses(string path, bool offline, List<
437442
}
438443

439444
if (!string.IsNullOrWhiteSpace(result.Output)) {
440-
resultEntries.AddRange(ExtractStatuses(result.Output));
445+
foreach(GitStatusData data in ExtractStatuses(result.Output)) {
446+
447+
// Skip submodule folder as they show changes when content has changed OR it has unknown assets (which is confusing).
448+
if (m_SubmoduleRoots.Count > 0 && m_SubmoduleRoots.Contains(data.Path))
449+
continue;
450+
451+
resultEntries.Add(data);
452+
}
441453
}
442454

443455
// Check submodules too.
@@ -451,7 +463,14 @@ public static StatusOperationResult GetStatuses(string path, bool offline, List<
451463
}
452464

453465
if (!string.IsNullOrWhiteSpace(result.Output)) {
454-
resultEntries.AddRange(ExtractStatuses(result.Output, pathFilter: path.Replace('\\', '/')));
466+
foreach (GitStatusData data in ExtractStatuses(result.Output, pathFilter: path.Replace('\\', '/'))) {
467+
468+
// Skip submodule folder as they show changes when content has changed OR it has unknown assets (which is confusing).
469+
if (m_SubmoduleRoots.Count > 0 && m_SubmoduleRoots.Contains(data.Path))
470+
continue;
471+
472+
resultEntries.Add(data);
473+
}
455474
}
456475
}
457476

@@ -1440,11 +1459,7 @@ public static IEnumerable<string> ListAllSubmodulePaths(int timeout = ONLINE_COM
14401459
{
14411460
var result = ShellUtils.ExecuteCommand(Git_Command, $"submodule status --recursive", timeout, shellMonitor);
14421461

1443-
if (!string.IsNullOrEmpty(result.Error)) {
1444-
yield break;
1445-
}
1446-
1447-
if (string.IsNullOrWhiteSpace(result.Output)) {
1462+
if (!string.IsNullOrEmpty(result.Error) || string.IsNullOrWhiteSpace(result.Output)) {
14481463
yield break;
14491464
}
14501465

0 commit comments

Comments
 (0)