Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nuke-build/nuke
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.10.3
Choose a base ref
...
head repository: nuke-build/nuke
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0.10.4
Choose a head ref
  • 3 commits
  • 3 files changed
  • 2 contributors

Commits on Oct 9, 2018

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    cdc7672 View commit details

Commits on Oct 10, 2018

  1. Copy the full SHA
    e3380f1 View commit details
  2. Merge branch 'hotfix/0.10.4'

    matkoch committed Oct 10, 2018
    Copy the full SHA
    bb3c3ac View commit details
Showing with 15 additions and 10 deletions.
  1. +5 −1 CHANGELOG.md
  2. +6 −0 source/Nuke.Common.Tests/GitRepositoryTest.cs
  3. +4 −9 source/Nuke.Common/Git/GitRepository.cs
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [vNext]

## [0.10.4] / 2018-10-10
- Fixed `GitRepository` when origin url is a ssh url without username.

## [0.10.3] / 2018-10-05
- Fixed `WinRelativePath` and `UnixRelativePath` to use correct separator

@@ -167,7 +170,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Added CLT tasks for Git
- Fixed background color in console output

[vNext]: https://github.com/nuke-build/nuke/compare/0.10.3...HEAD
[vNext]: https://github.com/nuke-build/nuke/compare/0.10.4...HEAD
[0.10.4]: https://github.com/nuke-build/nuke/compare/0.10.3...0.10.4
[0.10.3]: https://github.com/nuke-build/nuke/compare/0.10.2...0.10.3
[0.10.2]: https://github.com/nuke-build/nuke/compare/0.10.1...0.10.2
[0.10.1]: https://github.com/nuke-build/nuke/compare/0.10.0...0.10.1
6 changes: 6 additions & 0 deletions source/Nuke.Common.Tests/GitRepositoryTest.cs
Original file line number Diff line number Diff line change
@@ -26,6 +26,12 @@ public class GitRepositoryTest
[InlineData("git@git.test.org/test/", "git.test.org", "test")]
[InlineData("git@git.test.org/test.git", "git.test.org", "test")]
[InlineData("ssh://git@git.test.org/test.git", "git.test.org", "test")]
[InlineData("ssh://git@git.test.org:1234/test.git", "git.test.org", "test")]
[InlineData("ssh://git.test.org/test/test", "git.test.org", "test/test")]
[InlineData("ssh://git.test.org:1234/test/test", "git.test.org", "test/test")]
[InlineData("https://git.test.org:1234/test/test", "git.test.org", "test/test")]
[InlineData("git://git.test.org:1234/test/test", "git.test.org", "test/test")]
[InlineData("git://git.test.org/test/test", "git.test.org", "test/test")]
public void FromUrlTest(string url, string endpoint, string identifier)
{
var repository = GitRepository.FromUrl(url);
13 changes: 4 additions & 9 deletions source/Nuke.Common/Git/GitRepository.cs
Original file line number Diff line number Diff line change
@@ -61,15 +61,10 @@ public static GitRepository FromLocalDirectory(string directory, string branch =

private static (string endpoint, string identifier) ParseUrl(string url)
{
var match = new[]
{
@"git@(?<endpoint>[^:/]+?)(:|/)(?<identifier>.+?)/?(\.git)?$",
@"^https?://([^:]+:[^:@]+@)?(?<endpoint>[^/]+?)/(?<identifier>.+?)/?(\.git)?$"
}
.Select(x => Regex.Match(url.Trim(), x))
.FirstOrDefault(x => x.Success);
ControlFlow.Assert(match != null, $"Url '{url}' could not be parsed.");

var regex = new Regex(@"^(?'protocol'\w+\:\/\/)?(?>(?'user'.*)@)?(?'endpoint'[^\/:]+)(?>\:(?'port'\d+))?[\/:](?'identifier'.*?)\/?(?>\.git)?$");
var match = regex.Match(url.Trim());

ControlFlow.Assert(match.Success, $"Url '{url}' could not be parsed.");
return (match.Groups["endpoint"].Value, match.Groups["identifier"].Value);
}