Do not include /.git file in calculating subdirectory size

This commit is contained in:
Brandon Dahler 2012-12-25 00:31:36 -06:00
parent 93125e9e23
commit e01143389e

View file

@ -1069,8 +1069,12 @@ namespace SparkleLib.Git {
try {
foreach (DirectoryInfo directory in parent.GetDirectories ())
size += CalculateSizes (directory);
foreach (DirectoryInfo directory in parent.GetDirectories ()) {
// Do not include LocalPath/.git file if it is a subdirectory
// This will not affect calling CalculateSizes on /.git directly
if (directory.FullName != Path.Combine (LocalPath, ".git"))
size += CalculateSizes (directory);
}
} catch (Exception e) {
SparkleLogger.LogInfo ("Local", "Error calculating size", e);