Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .azure-pipelines/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ parameters:

variables:
- name: 'GVFSMajorAndMinorVersion'
value: '2.0'
value: '2.1'
- name: 'GVFSRevision'
value: $(Build.BuildNumber)
- name: 'GVFSVersion'
Expand Down
24 changes: 23 additions & 1 deletion GVFS/GVFS.CommandLine.Tests/GvfsMainCliTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,28 @@ public void Dehydrate_FullCommandLine_ParsesCorrectly()
Assert.That(parseResult.Errors, Is.Empty, "Full dehydrate command with --confirm --folders should parse without errors");
}

[Test]
public void Dehydrate_DiscardBackup_ParsesCorrectly()
{
var parseResult = rootCommand.Parse(new[] { "dehydrate", "--confirm", "--full", "--discard-backup" });
Assert.That(parseResult.Errors, Is.Empty, "dehydrate --confirm --full --discard-backup should parse without errors");
}

[Test]
public void Dehydrate_PruneBackups_IsSubcommand()
{
var dehydrate = FindSubcommand("dehydrate");
var pruneBackups = dehydrate.Subcommands.FirstOrDefault(c => c.Name == "prune-backups");
Assert.That(pruneBackups, Is.Not.Null, "dehydrate should have a 'prune-backups' subcommand");
}

[Test]
public void Dehydrate_PruneBackups_ParsesCorrectly()
{
var parseResult = rootCommand.Parse(new[] { "dehydrate", "prune-backups" });
Assert.That(parseResult.Errors, Is.Empty, "dehydrate prune-backups should parse without errors");
}

[Test]
public void Service_FullCommandLine_ParsesCorrectly()
{
Expand Down Expand Up @@ -353,7 +375,7 @@ public void Clone_HasAllExpectedOptions()
[Test]
public void Dehydrate_HasAllExpectedOptions()
{
var expected = new[] { "--confirm", "--no-status", "--folders" };
var expected = new[] { "--confirm", "--no-status", "--folders", "--full", "--discard-backup" };
foreach (var optName in expected)
{
Assert.That(FindOptionOnCommand("dehydrate", optName), Is.Not.Null,
Expand Down
15 changes: 14 additions & 1 deletion GVFS/GVFS.Common/NamedPipes/NamedPipeMessages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,11 @@ public Request()
{
}

public Request(string backupFolderPath, string folders)
public Request(string backupFolderPath, string folders, bool discardBackup = false)
{
this.Folders = folders;
this.BackupFolderPath = backupFolderPath;
this.DiscardBackup = discardBackup;
}

public static Request FromMessage(Message message)
Expand All @@ -228,6 +229,12 @@ public static Request FromMessage(Message message)

public string BackupFolderPath { get; set; }

/// <summary>
/// When true, the mount deletes the backup folder during its unmounted window
/// (the moved ProjFS placeholders can only be deleted while the repo is unmounted).
/// </summary>
public bool DiscardBackup { get; set; }

public Message CreateMessage()
{
return new Message(Dehydrate, GVFSJsonOptions.Serialize(this));
Expand All @@ -253,6 +260,12 @@ public Response(string result)
public List<string> SuccessfulFolders { get; set; }
public List<string> FailedFolders { get; set; }

/// <summary>
/// True if the backup folder was requested to be discarded and was successfully
/// deleted during the unmounted window.
/// </summary>
public bool BackupDiscarded { get; set; }

public static Response FromMessage(Message message)
{
return GVFSJsonOptions.Deserialize<Response>(message.Body);
Expand Down
Loading
Loading