8000 Does not throw when parsing a Remote with no url · philhack/libgit2sharp@27dd2c0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 27dd2c0

Browse files
committed
Does not throw when parsing a Remote with no url
Fix libgit2#484
1 parent 1aa5f11 commit 27dd2c0

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

LibGit2Sharp.Tests/RemoteFixture.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public void CanEnumerateTheRemotes()
4040
count++;
4141
}
4242

43-
Assert.Equal(1, count);
43+
Assert.Equal(2, count);
4444
}
4545
}
4646

@@ -155,5 +155,16 @@ public void CanTellIfARemoteNameIsValid(string refname, bool expectedResult)
155155
Assert.Equal(expectedResult, repo.Network.Remotes.IsValidName(refname));
156156
}
157157
}
158+
159+
[Fact]
160+
public void DoesNotThrowWhenARemoteHasNoUrlSet()
161+
{
162+
using (var repo = new Repository(StandardTestRepoPath))
163+
{
164+
var noUrlRemote = repo.Network.Remotes["no_url"];
165+
Assert.NotNull(noUrlRemote);
166+
Assert.Equal(string.Empty, noUrlRemote.Url);
167+
}
168+
}
158169
}
159170
}

LibGit2Sharp.Tests/Resources/testrepo_wd/dot_git/config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
[remote "origin"]
1010
fetch = +refs/heads/*:refs/remotes/origin/*
1111
url = c:/GitHub/libgit2sharp/Resources/testrepo.git
12+
[remote "no_url"]
13+
url =
14+
fetch = +refs/heads/*:refs/remotes/no_url/*
1215
[branch "master"]
1316
remote = origin
1417
merge = refs/heads/master

0 commit comments

Comments
 (0)
0