Skip to content
7 changes: 6 additions & 1 deletion Scalar.Common/Git/GitVersion.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Text;
using Scalar.Common.Tracing;

namespace Scalar.Common.Git
{
Expand Down Expand Up @@ -164,7 +165,7 @@ public static bool TryParseVersion(string input, out GitVersion version)
}

if (numComponents > 6) {
extra = parsedComponents[6];
extra = parsedComponents[6].Trim();
Comment thread
derrickstolee marked this conversation as resolved.
}

version = new GitVersion(major, minor, build, platform, revision, minorRevision, rc, extra);
Expand Down Expand Up @@ -221,6 +222,10 @@ public override string ToString()
sb.AppendFormat(".{0}.{1}.{2}", this.Platform, this.Revision, this.MinorRevision);
}

if (this.Extra != null) {
sb.Append($".{this.Extra}");
}

return sb.ToString();
}

Expand Down
47 changes: 46 additions & 1 deletion Scalar.Common/Maintenance/ConfigStep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,52 @@ public bool TrySetConfig(out string error)
return false;
}

return this.ConfigureWatchmanIntegration(out error);
this.GetConfigSettings();
Comment thread
derrickstolee marked this conversation as resolved.
Outdated

if (this.existingConfigSettings == null)
Comment thread
derrickstolee marked this conversation as resolved.
Outdated
{
return this.ConfigureWatchmanIntegration(out error);
}

GitProcess.ConfigResult config = null;
GitProcess.Result getResult = this.RunGitCommand(
process => {
config = process.GetFromLocalConfig("feature.scalar");
return null;
},
nameof(GitProcess.GetFromLocalConfig)
);
GitFeatureFlags flags = GitVersion.GetAvailableGitFeatures(this.Context.Tracer);
config.TryParseAsString(out string scalar, out error, defaultValue: "true");

if (scalar.Equals("false"))
Comment thread
derrickstolee marked this conversation as resolved.
Outdated
{
GitProcess.Result deleteResult = this.RunGitCommand(
process => process.DeleteFromLocalConfig("core.fsmonitor"),
nameof(GitProcess.DeleteFromLocalConfig)
);

return deleteResult.ExitCodeIsSuccess;
}
else if (scalar.Equals("experimental")
Comment thread
derrickstolee marked this conversation as resolved.
Outdated
// Make sure Git supports builtin FS Monitor
&& flags.HasFlag(GitFeatureFlags.BuiltinFSMonitor)
// For now, this doesn't work on Linux
&& !RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
Comment thread
derrickstolee marked this conversation as resolved.
Outdated
{
// ":internal:" is a custom value to specify the builtin
// FS Monitor feature.
GitProcess.Result setResult = this.RunGitCommand(
process => process.SetInLocalConfig("core.fsmonitor", ":internal:"),
nameof(GitProcess.SetInLocalConfig)
);

return setResult.ExitCodeIsSuccess;
}
else
{
return this.ConfigureWatchmanIntegration(out error);
}
}

protected override void PerformMaintenance()
Expand Down