0

I've been running round in circles for days now, I'm trying to implement a "pull" command which I understand libgit2sharp doesn't implement directly. I understand that I have to fetch from the remote and then merge this. I came up with the following code:

this._repo = new Repository(workingDir);
Credentials credentials = new Credentials() {Username = this._username, Password = this._password};
Remote remote = this._repo.Network.Remotes["origin"];
FetchOptions fetchOptions = new FetchOptions();
fetchOptions.Credentials = credentials;
var branch = @"refs/heads/TestBranch:refs/remotes/origin/TestBranch";
this._repo.Network.Fetch(remote, new string[] { branch }, fetchOptions);
//this._repo.Fetch(this._repo.Head.Name);
//this._repo.Fetch(remote.Name, fetchOptions);
//this._repo.Network.Fetch(remote, fetchOptions);  //this._repo.Network.Remotes["origin"], new FetchOptions() { Credentials = new Credentials() { Password = this._password, Username = this._username }});

I've left in the comments to show all the other variations of Fetch I've tried- but no matter what I try I always get the same error:

An error was raised by libgit2. Category = NoMemory (User).

Out of memory

The only time I've managed to not get this error was when I didn't enter my credentials and I got a 401 return code.

This is using a remote BitBucket account over HTTPS, I found 1 similar problem with BitBucket to do with the username being in the remote entry however this was supposed to be fix and still didn't work when I removed the username anyway.

Steamos
  • 1
  • 1
  • 1
  • it reads as if the out of memory exception is occurring on the other end. What can you do about it? – T McKeown Mar 03 '14 at 19:52
  • If that's the case, then I would also expect to have the same issues when I pull/fetch from git Bash, this isn't the case however, from git Bash it works as normal, as do other commands from the code I've written (for example pushes) – Steamos Mar 03 '14 at 20:04
  • but you are not getting an outOfMemoryException, you are getting a message from the service that a NoMemory error occurred. oh well... good luck – T McKeown Mar 03 '14 at 20:19
  • Either your memory space is very fragmented or...this is a bug ;-) Could you please open an **[issue](https://github.com/libgit2/libgit2sharp/issues/new)** in the project tracker? However, in order to correctly fix this, a repro case would be required. Would you be ok to share the repository details you're trying to fetch from? – nulltoken Mar 03 '14 at 20:19
  • @TMcKeown: no, this is not a message from the service, this is a message from LibGit2Sharp. – Edward Thomson Mar 03 '14 at 20:23
  • ok, i dont use it... so i wouldn't know. – T McKeown Mar 03 '14 at 20:24
  • Ok nulltoken, will do, I have tested this on 2 different pc's with differing versions of VS 2012 and the same error happens on both. I'll set up another account to be used for testing and pass on the details. – Steamos Mar 03 '14 at 20:32
  • Open issue here: https://github.com/libgit2/libgit2sharp/issues/641 – Steamos Mar 03 '14 at 20:48

0 Answers0