Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Commit

Permalink
Don't allow ssh remotes (#789)
Browse files Browse the repository at this point in the history
* Merge branch 'master' of https://github.com/NuKeeperDotNet/NuKeeper

* github explanation

* remove bitbucket

* update commands

* set favicon

* Add github local support

* fix comment

* update tests

* update references

* actually use remoteinfo

* Users can use a ssh remote
  • Loading branch information
MarcBruins authored May 20, 2019
1 parent 472f715 commit 5562996
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions NuKeeper.Git/LibGit2SharpDiscoveryDriver.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using LibGit2Sharp;
using NuKeeper.Abstractions;
using NuKeeper.Abstractions.Formats;
using NuKeeper.Abstractions.Git;
using NuKeeper.Abstractions.Logging;

namespace NuKeeper.Git
{
public class LibGit2SharpDiscoveryDriver : IGitDiscoveryDriver
{
private readonly INuKeeperLogger _logger;

public LibGit2SharpDiscoveryDriver(INuKeeperLogger logger)
{
_logger = logger;
}

public bool IsGitRepo(Uri repositoryUri)
{
var discovered = DiscoverRepo(repositoryUri);
Expand All @@ -35,12 +44,21 @@ public IEnumerable<GitRemote> GetRemotes(Uri repositoryUri)
{
foreach (var remote in repo.Network.Remotes)
{
var gitRemote = new GitRemote
Uri.TryCreate(remote.Url, UriKind.Absolute, out repositoryUri);

if (repositoryUri != null)
{
var gitRemote = new GitRemote
{
Name = remote.Name,
Url = repositoryUri
};
gitRemotes.Add(gitRemote);
}
else
{
Name = remote.Name,
Url = new Uri(remote.Url)
};
gitRemotes.Add(gitRemote);
_logger.Normal($"Cannot parse {remote.Url} to URI. SSH remote is currently not supported");
}
}

return gitRemotes;
Expand Down

0 comments on commit 5562996

Please sign in to comment.