Skip to content
This repository was archived by the owner on Dec 15, 2020. It is now read-only.
This repository was archived by the owner on Dec 15, 2020. It is now read-only.

Cannot add HEAD to a bundle #50

@mtausig

Description

@mtausig

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 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions