libgit2/libgit2 — pull request #1006 by ethomson (2012-10-21 18:06:17+00:00)
Title: create FETCH_HEAD specially instead of as a ref file

libgit2 creates FETCH_HEAD as if it were a normal ref (ie, a bare id string). git expects FETCH_HEAD in a special format and cannot parse the file we create. Eg:

% git merge FETCH_HEAD
fatal: Error in line 1: c497a63bd6ac0f07b06b18e4891771fdbcd31dd6

The format of the file is:
oid \t [empty or "not-for-merge"] \t description and remote url

Notes: this patch only includes writing FETCH_HEAD, not reading. I anticipate a git_fetchhead_foreach() that allows callers to read this data after a fetch.