libgit2/pygit2 — pull request #216 by bors-ltd (2013-04-29 21:33:04+00:00)
Title: repository: allow again creating a blob from a file on disk

Hi,

There is a behaviour change in libgit2 where "git_blob_create_fromfile" was split into "git_blob_create_fromdisk" and "git_blob_create_fromworkdir".

PyGit2 is calling "git_blob_create_fromworkdir" and thus preventing from creating a (loose) blob from any file. This is particularly useful with bare repos where there is no workdir.

The proposed patch detects if the path is inside or outside the repo to call the appropriate function. Yes, it's rather a convention than a heuristic.

An alternative is to rename "create_blob_fromfile" to "create_blob_fromworkdir" to match libgit2's API, and add another "create_blob_fromdisk". But you'll probably wait for 0.19 or even 1.0 to break the API.

There is no test, it's just an RFC.