GitRepo.getFetchHeadItems

Read each item in the FETCH_HEAD file to the output range sink, and return the sink.

  1. FetchHeadItem[] getFetchHeadItems()
  2. Range getFetchHeadItems(Range sink)
    struct GitRepo
    Range
    getFetchHeadItems
    (
    Range
    )
    (
    Range sink
    )
    if (
    isOutputRange!(Range, FetchHeadItem)
    )

Examples

auto repo = initRepo(_userRepo, OpenBare.yes);
scope(exit) rmdirRecurse(_userRepo);

string[] fetchHeadItems = [
    "23c3c6add8162693f85b3b41c9bf6550a71a57d3		branch 'master' of git://github.com/D-Programming-Language/dmd\n",
    "aaf64112624abab1f6cc8f610223f6e12b525e09		branch 'master' of git://github.com/D-Programming-Language/dmd\n"
];

std.file.write(buildPath(repo.path, "FETCH_HEAD"), fetchHeadItems.join());

auto buffer = repo.getFetchHeadItems(appender!(FetchHeadItem[]));

foreach (string line, FetchHeadItem item; lockstep(fetchHeadItems, buffer.data))
{
    string commitHex = line.split[0];

    assert(item.refName == "refs/heads/master");
    assert(item.remoteURL == "git://github.com/D-Programming-Language/dmd");
    assert(item.oid == GitOid(commitHex));
}

Meta