GitRepo.getFetchHeadItems

Return the list of items in the FETCH_HEAD file as an array of FetchHeadItem's.

  1. FetchHeadItem[] getFetchHeadItems()
    struct GitRepo
    getFetchHeadItems
    ()
  2. Range getFetchHeadItems(Range sink)

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());

foreach (string line, FetchHeadItem item; lockstep(fetchHeadItems, repo.getFetchHeadItems()))
{
    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