Skip to content

Commit 93f88a0

Browse files
Merge pull request #1655: Release for April 2020
Includes the following PRs: * #1642: Update Git to v2.26.0 * #1647: Fix commit-graph expiration * #1652: RepoRegistry: ignore non-existent repos * #1653: Update Git to include v2.26.1 The update to include Git v2.26.0 comes with a new default backend for `git rebase`. By switching from the `apply` backend to the `merge` backend, some rebase situations that would previously fail will now succeed automatically. This comes with a slight performance drawback, but it is the direction that the Git community has decided to go. Please see [the Git documentation](https://git-scm.com/docs/git-rebase#_behavioral_differences) for more details.
2 parents 11bf734 + 8dc98be commit 93f88a0

10 files changed

Lines changed: 36 additions & 13 deletions

File tree

GVFS/GVFS.Build/GVFS.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<PropertyGroup Label="Parameters">
55
<GVFSVersion>0.2.173.2</GVFSVersion>
6-
<GitPackageVersion>2.20200221.5</GitPackageVersion>
6+
<GitPackageVersion>2.20200414.2</GitPackageVersion>
77
</PropertyGroup>
88

99
<PropertyGroup Label="DefaultSettings">

GVFS/GVFS.Common/Git/GitProcess.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public class GitProcess : ICredentialStore
1616

1717
private static readonly Encoding UTF8NoBOM = new UTF8Encoding(false);
1818
private static bool failedToSetEncoding = false;
19+
private static string expireTimeDateString;
1920

2021
/// <summary>
2122
/// Lock taken for duration of running executingProcess.
@@ -81,6 +82,19 @@ public GitProcess(string gitBinPath, string workingDirectoryRoot)
8182
}
8283
}
8384

85+
public static string ExpireTimeDateString
86+
{
87+
get
88+
{
89+
if (expireTimeDateString == null)
90+
{
91+
expireTimeDateString = DateTime.Now.Subtract(TimeSpan.FromDays(1)).ToShortDateString();
92+
}
93+
94+
return expireTimeDateString;
95+
}
96+
}
97+
8498
public bool LowerPriority { get; set; }
8599

86100
public static Result Init(Enlistment enlistment)
@@ -540,7 +554,7 @@ public Result WriteCommitGraph(string objectDir, List<string> packs)
540554
{
541555
// Do not expire commit-graph files that have been modified in the last hour.
542556
// This will prevent deleting any commit-graph files that are currently in the commit-graph-chain.
543-
string command = $"commit-graph write --stdin-packs --split --size-multiple=4 --expire-time={1 * 60 * 60} --object-dir \"{objectDir}\"";
557+
string command = $"commit-graph write --stdin-packs --split --size-multiple=4 --expire-time={ExpireTimeDateString} --object-dir \"{objectDir}\"";
544558
return this.InvokeGitInWorkingDirectoryRoot(
545559
command,
546560
useReadObjectHook: true,

GVFS/GVFS.FunctionalTests/Tests/GitCommands/GitRepoTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using GVFS.Tests.Should;
66
using NUnit.Framework;
77
using System;
8-
using System.Collections.Generic;
98
using System.IO;
109
using System.Linq;
1110

@@ -204,6 +203,7 @@ protected void CreateEnlistment(string commitish = null)
204203
{
205204
this.Enlistment = GVFSFunctionalTestEnlistment.CloneAndMount(GVFSTestConfig.PathToGVFS, commitish: commitish);
206205
GitProcess.Invoke(this.Enlistment.RepoRoot, "config advice.statusUoption false");
206+
GitProcess.Invoke(this.Enlistment.RepoRoot, "config core.editor true");
207207
this.ControlGitRepo = ControlGitRepo.Create(commitish);
208208
this.ControlGitRepo.Initialize();
209209
}

GVFS/GVFS.FunctionalTests/Tools/ControlGitRepo.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
using GVFS.FunctionalTests.FileSystemRunners;
2-
using System;
1+
using System;
32
using System.IO;
4-
using System.Runtime.InteropServices;
53

64
namespace GVFS.FunctionalTests.Tools
75
{
@@ -52,6 +50,7 @@ public void Initialize()
5250
Directory.CreateDirectory(this.RootPath);
5351
GitProcess.Invoke(this.RootPath, "init");
5452
GitProcess.Invoke(this.RootPath, "config core.autocrlf false");
53+
GitProcess.Invoke(this.RootPath, "config core.editor true");
5554
GitProcess.Invoke(this.RootPath, "config merge.stat false");
5655
GitProcess.Invoke(this.RootPath, "config merge.renames false");
5756
GitProcess.Invoke(this.RootPath, "config advice.statusUoption false");

GVFS/GVFS.FunctionalTests/Tools/GitHelpers.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ public static void ValidateGitCommand(
123123

124124
Dictionary<string, string> environmentVariables = new Dictionary<string, string>();
125125
environmentVariables["GIT_QUIET"] = "true";
126+
environmentVariables["GIT_COMMITTER_DATE"] = "Thu Feb 16 10:07:35 2017 -0700";
126127

127128
ProcessResult expectedResult = GitProcess.InvokeProcess(controlRepoRoot, command, environmentVariables);
128129
ProcessResult actualResult = GitHelpers.InvokeGitAgainstGVFSRepo(gvfsRepoRoot, command, environmentVariables);

GVFS/GVFS.Service/Handlers/GetActiveRepoListHandler.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using GVFS.Common.NamedPipes;
33
using GVFS.Common.Tracing;
44
using System.Collections.Generic;
5+
using System.IO;
56
using System.Linq;
67

78
namespace GVFS.Service.Handlers
@@ -68,6 +69,11 @@ public void Run()
6869

6970
private bool IsValidRepo(string repoRoot)
7071
{
72+
if (!Directory.Exists(repoRoot))
73+
{
74+
return false;
75+
}
76+
7177
string gitBinPath = GVFSPlatform.Instance.GitInstallation.GetInstalledGitBinPath();
7278

7379
string hooksVersion = null;

GVFS/GVFS.Service/IRepoRegistry.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public interface IRepoRegistry
88
bool TryDeactivateRepo(string repoRoot, out string errorMessage);
99
bool TryGetActiveRepos(out List<RepoRegistration> repoList, out string errorMessage);
1010
bool TryRemoveRepo(string repoRoot, out string errorMessage);
11-
void AutoMountRepos(string userId, int sessionId);
11+
void AutoMountRepos(string userId, int sessionId, bool checkDirectoryExists = true);
1212
void TraceStatus();
1313
}
1414
}

GVFS/GVFS.Service/RepoRegistry.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,14 +171,19 @@ public bool TryRemoveRepo(string repoRoot, out string errorMessage)
171171
return false;
172172
}
173173

174-
public void AutoMountRepos(string userId, int sessionId)
174+
public void AutoMountRepos(string userId, int sessionId, bool checkDirectoryExists = true)
175175
{
176176
using (ITracer activity = this.tracer.StartActivity("AutoMount", EventLevel.Informational))
177177
{
178178
List<RepoRegistration> activeRepos = this.GetActiveReposForUser(userId);
179179
foreach (RepoRegistration repo in activeRepos)
180180
{
181181
// TODO #1089: We need to respect the elevation level of the original mount
182+
if (checkDirectoryExists && !Directory.Exists(repo.EnlistmentRoot))
183+
{
184+
continue;
185+
}
186+
182187
if (!this.repoMounter.MountRepository(repo.EnlistmentRoot, sessionId))
183188
{
184189
this.SendNotification(

GVFS/GVFS.UnitTests/Maintenance/PostFetchStepTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class PostFetchStepTests
1818
private MockGitProcess gitProcess;
1919
private GVFSContext context;
2020

21-
private string CommitGraphWriteCommand => $"commit-graph write --stdin-packs --split --size-multiple=4 --expire-time=3600 --object-dir \"{this.context.Enlistment.GitObjectsRoot}\"";
21+
private string CommitGraphWriteCommand => $"commit-graph write --stdin-packs --split --size-multiple=4 --expire-time={GitProcess.ExpireTimeDateString} --object-dir \"{this.context.Enlistment.GitObjectsRoot}\"";
2222
private string CommitGraphVerifyCommand => $"commit-graph verify --shallow --object-dir \"{this.context.Enlistment.GitObjectsRoot}\"";
2323

2424
[TestCase]

GVFS/GVFS.UnitTests/Service/Mac/MacServiceTests.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
using GVFS.Common;
2-
using GVFS.Common.FileSystem;
32
using GVFS.Common.NamedPipes;
4-
using GVFS.Platform.Mac;
53
using GVFS.Service;
64
using GVFS.Service.Handlers;
75
using GVFS.UnitTests.Mock.Common;
@@ -38,7 +36,7 @@ public void SetUp()
3836
public void ServiceStartTriggersAutoMountForCurrentUser()
3937
{
4038
Mock<IRepoRegistry> repoRegistry = new Mock<IRepoRegistry>(MockBehavior.Strict);
41-
repoRegistry.Setup(r => r.AutoMountRepos(ExpectedActiveUserId.ToString(), ExpectedSessionId));
39+
repoRegistry.Setup(r => r.AutoMountRepos(ExpectedActiveUserId.ToString(), ExpectedSessionId, true));
4240
repoRegistry.Setup(r => r.TraceStatus());
4341

4442
GVFSService service = new GVFSService(
@@ -86,7 +84,7 @@ public void RepoRegistryMountsOnlyRegisteredRepos()
8684
repoMounterMock.Object,
8785
null);
8886

89-
repoRegistry.AutoMountRepos(ExpectedActiveUserId.ToString(), ExpectedSessionId);
87+
repoRegistry.AutoMountRepos(ExpectedActiveUserId.ToString(), ExpectedSessionId, checkDirectoryExists: false);
9088

9189
repoMounterMock.VerifyAll();
9290
}

0 commit comments

Comments
 (0)