8000 Add LibGit2Sharp support by slang25 · Pull Request #73 · NuKeeperDotNet/NuKeeper · GitHub
[go: up one dir, main page]

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

Add LibGit2Sharp support #73

Merged
merged 3 commits into from
Jul 25, 2017
Merged

Conversation

slang25
Copy link
Member
@slang25 slang25 commented Jul 24, 2017

Fixes #10

@@ -12,7 +13,8 @@ private static string NuKeeperTempFilesPath()

public static void DeleteExistingTempDirs()
{
var dirs = Directory.EnumerateDirectories(NuKeeperTempFilesPath());
var dirInfo = new DirectoryInfo(NuKeeperTempFilesPath());
var dirs = dirInfo.Exists ? dirInfo.EnumerateDirectories() : Enumerable.Empty<DirectoryInfo>();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made this change cause it doesn't work on first use otherwise

@slang25
Copy link
Member Author
slang25 commented Jul 24, 2017

I think I may not have needed to add the username command line argument, as the CredentialsProvider has an argument called usernameFromUrl, however I'm a little confused by how this should work.

I point it at a repo that belongs to an org, I was expecting this to create a fork, we push to that fork, then the PR is from that fork, in which case usernameFromUrl would work, however I don't think this is the case, I think this always pushes the code to a branch on the org repo, and creates a PR from there, this means we'll need to pass the username through and have to have some permissions on the org repo.

README.md Outdated
@@ -43,6 +43,7 @@ C:\Code\NuKeeper\NuKeeper>dotnet run mode=organisation github_token=<GitToken> g
| Name | Alias | Default value | Required |
|----------------------------------|-------|------------------------|-----------------|
| mode | m | | Yes |
| github_user | u | | Yes |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to also add an explanation of parameter below and add the parameter to the examples above

Copy link
Collaborator
@cohen990 cohen990 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just need to fix up the README

@AnthonySteele
Copy link
Member

Why do we need a github user?

@slang25
Copy link
Member Author
slang25 commented Jul 25, 2017

We don't, my bad.

@slang25
Copy link
Member Author
slang25 commented Jul 25, 2017

@AnthonySteele Updated, I was rushing though 🤞

public Task Clone(Uri pullEndpoint)
{
Repository.Clone(pullEndpoint.ToString(), _repoStoragePath);
return Task.CompletedTask;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is LibGit2Sharp likely to become async at any time soon?
Basically if not, and we discard the other git driver we should then make these methods sync.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, not anytime soon is my understanding libgit2/libgit2sharp#1440

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall I do that in this PR?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can cleanup in a following PR.

RunAll(repositoryDiscovery, lookups, updateSelection, github)
// get some storage space
var tempDir = TempFiles.MakeUniqueTemporaryPath();
var githubUser = github.GetCurrentUser().GetAwaiter().GetResult();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to push these lines into a single async method so that there's only one point of resynchronisation with .GetAwaiter().GetResult()

@AnthonySteele AnthonySteele merged commit 116c1e9 into NuKeeperDotNet:master Jul 25, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0