Allows Repository_getitem, Repository_read(_raw), Repository_create_commit,
Repository_create_tag and Object_read_raw to use short hex strings to
lookup objects.
Also test getting objects from Repository using prefixes, looking up commit
trees and parents by hex prefix, and looking up tag targets by prefix.
Also stop raising TypeError if passing a too-short hex prefix to the
lookup functions, instead use ValueError.
Do not allow to create commits, trees, blobs and tags directly from the
constructor. For instance, now calling "Commit(...)" raises an error.
Instead use the create methods of the repository object:
Before Now
----------------------------- -----------------------------
commit = Commit(repo, ...) sha = repo.create_commit(...)
tag = Tag(repo, ...) sha = repo.create_tag(...)
Most often you won't need to get the object just created, but if you
do just call "repo[sha]" afterwards. (Methods to create blobs and trees
are still missing, just like before.)
Similarly the method that creates a tree object from the index file does
not return the tree object anymore, but just its SHA:
Before Now
----------------------------- -----------------------------
tree = index.create_tree() sha = index.create_tree()