mono / ngit

Automated jgit port to c#
261 stars 151 forks source link

Cannot add HEAD to a bundle #50

Open mtausig opened 11 years ago

mtausig commented 11 years ago

I want to create a bundle with the BundleWriter class. I can add branches to the bundle, but adding the current HEAD (which is neccesary to actually pull from a bundle) does not work. The following code

using System;
using NGit;
using NGit.Storage.File;
using NGit.Transport;

public static class M
{
  static void Main()
  {
    string workingDir = "/tmp/gittestdir";
    var repository = new FileRepository(workingDir);
    var bundleWriter = new BundleWriter(repository);
    Ref head = repository.GetRef("HEAD");
    bundleWriter.Include(head);
 }
}

throws an exception:

Unhandled Exception: System.ArgumentException: Invalid ref name: HEAD
  at NGit.Transport.BundleWriter.Include (System.String name, NGit.AnyObjectId id) [0x00000] in <filename unknown>:0 
  at NGit.Transport.BundleWriter.Include (Ref r) [0x00000] in <filename unknown>:0 
  at M.Main () [0x00000] in <filename unknown>:0 
CumpsD commented 8 years ago

Seems to be already fixed in jgit but not in ngit:

http://stackoverflow.com/questions/26298129/jgit-bundlewriter-error-when-including-refs https://git.eclipse.org/r/#/c/35092/1/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleWriter.java