Skip to content

Added failing test for relative remote URLs (#648) #649

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
20 changes: 20 additions & 0 deletions LibGit2Sharp.Tests/FetchFixture.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using System.IO;
using LibGit2Sharp.Tests.TestHelpers;
using Xunit;
using Xunit.Extensions;
Expand Down Expand Up @@ -127,5 +128,24 @@ public void FetchRespectsConfiguredAutoTagSetting(TagFetchMode tagFetchMode, int
Assert.Equal(expectedTagCount, repo.Tags.Count());
}
}

[Fact]
public void CanFetchFromRelativeRemoteURL()
{
SelfCleaningDirectory scd = BuildSelfCleaningDirectory();
string path1 = Path.Combine(scd.DirectoryPath, "repo1");
string path2 = Path.Combine(scd.DirectoryPath, "repo2");
string path2RelativeToPath1 = "../path2";

Repository.Init(path1);
DirectoryHelper.CopyFilesRecursively(new DirectoryInfo(BareTestRepoPath), new DirectoryInfo(path2));
using (var repo = new Repository(path1)) {
var remote = repo.Network.Remotes.Add("relative", path2RelativeToPath1);
repo.Network.Fetch(remote);
var remoteRef = repo.Refs ["refs/remotes/relative/master"];
Assert.NotNull(remoteRef);
Assert.Equal("c47800c7266a2be04c571c04d5a6614691ea99bd", remoteRef.TargetIdentifier);
}
}
}
}