Skip to content

Commit 97be7c0

Browse files
Merge pull request #400: Update Git to v2.28.0
See microsoft/git#283. The new logic around `core.repositoryFormatVersion` and `extensions.*` config options causes problems in Scalar due to our use of sparse-checkout. This is resolved by some upstream fixes and some more careful config here.
2 parents 44869ce + 8dfab60 commit 97be7c0

File tree

3 files changed

+22
-18
lines changed

3 files changed

+22
-18
lines changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
VFS for Git (which is less flexible). Only update that version if we rely upon a
4444
new command-line interface in Git or if there is a truly broken interaction.
4545
-->
46-
<GitPackageVersion>2.20200622.2</GitPackageVersion>
46+
<GitPackageVersion>2.20200728.1</GitPackageVersion>
4747
<MinimumGitVersion>v2.25.0.vfs.1.1</MinimumGitVersion>
4848

4949
<WatchmanPackageUrl>https://github.com/facebook/watchman/suites/307436006/artifacts/304557</WatchmanPackageUrl>

Scalar.Common/Maintenance/ConfigStep.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ public bool TrySetConfig(out string error)
155155
{ "status.aheadbehind", "false" },
156156
{ "core.autocrlf", "false" },
157157
{ "core.safecrlf", "false" },
158+
{ "core.repositoryFormatVersion", "1" },
158159
};
159160

160161
if (this.UseGvfsProtocol.Value)

Scalar.FunctionalTests/Tests/GitCommands/GitRepoTests.cs

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -132,23 +132,6 @@ public virtual void SetupForTest()
132132
this.CreateEnlistment();
133133
}
134134

135-
if (this.validateWorkingTree == Settings.ValidateWorkingTreeMode.SparseMode)
136-
{
137-
StringBuilder sb = new StringBuilder();
138-
139-
foreach (string folder in SparseModeFolders)
140-
{
141-
sb.Append(folder.Replace(Path.DirectorySeparatorChar, TestConstants.GitPathSeparator)
142-
.Trim(TestConstants.GitPathSeparator));
143-
sb.Append("\n");
144-
}
145-
146-
GitProcess.InvokeProcess(this.ControlGitRepo.RootPath, "sparse-checkout init --cone", string.Empty);
147-
GitProcess.InvokeProcess(this.ControlGitRepo.RootPath, "sparse-checkout set --stdin", sb.ToString());
148-
GitProcess.InvokeProcess(this.Enlistment.RepoRoot, "sparse-checkout set --stdin", sb.ToString());
149-
this.pathPrefixes = SparseModeFolders;
150-
}
151-
152135
this.ValidateGitCommand("checkout " + this.ControlGitRepo.Commitish);
153136

154137
this.CheckHeadCommitTree();
@@ -218,6 +201,26 @@ protected void CreateEnlistment(string commitish = null)
218201
GitProcess.Invoke(this.Enlistment.RepoRoot, "config advice.statusUoption false");
219202
this.ControlGitRepo = ControlGitRepo.Create(commitish);
220203
this.ControlGitRepo.Initialize();
204+
205+
if (this.validateWorkingTree == Settings.ValidateWorkingTreeMode.SparseMode)
206+
{
207+
StringBuilder sb = new StringBuilder();
208+
209+
foreach (string folder in SparseModeFolders)
210+
{
211+
sb.Append(folder.Replace(Path.DirectorySeparatorChar, TestConstants.GitPathSeparator)
212+
.Trim(TestConstants.GitPathSeparator));
213+
sb.Append("\n");
214+
}
215+
216+
GitProcess.InvokeProcess(this.ControlGitRepo.RootPath, "sparse-checkout init --cone", string.Empty);
217+
GitProcess.InvokeProcess(this.ControlGitRepo.RootPath, "sparse-checkout set --stdin", sb.ToString());
218+
219+
// This line shouldn't be necessary!
220+
GitProcess.InvokeProcess(this.Enlistment.RepoRoot, "sparse-checkout init --cone", string.Empty);
221+
GitProcess.InvokeProcess(this.Enlistment.RepoRoot, "sparse-checkout set --stdin", sb.ToString());
222+
this.pathPrefixes = SparseModeFolders;
223+
}
221224
}
222225

223226
protected virtual void DeleteEnlistment()

0 commit comments

Comments
 (0)