diff options
| author | Vicent Marti <tanoku@gmail.com> | 2010-11-14 22:06:10 +0200 |
|---|---|---|
| committer | Vicent Marti <tanoku@gmail.com> | 2010-11-16 02:59:13 +0200 |
| commit | 237da40181daa416e25527aee35173a1cd5ad92b (patch) | |
| tree | c9340f5c6b4ae99c3a871a1cf50490aec3facc6a /src/repository.c | |
| parent | 0be421994e34e2d8e200f15b64894dd0c09c4eec (diff) | |
| download | libgit2-237da40181daa416e25527aee35173a1cd5ad92b.tar.gz | |
Add support for blob files
Blob files can now be loaded from the repository like all the other base
Git types.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
Diffstat (limited to 'src/repository.c')
| -rw-r--r-- | src/repository.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/repository.c b/src/repository.c index 8cef18218..4beb3e0c7 100644 --- a/src/repository.c +++ b/src/repository.c @@ -28,6 +28,7 @@ #include "repository.h" #include "commit.h" #include "tag.h" +#include "blob.h" #include "fileops.h" static const int default_table_size = 32; @@ -39,7 +40,7 @@ static const size_t object_sizes[] = { 0, sizeof(git_commit), sizeof(git_tree), - sizeof(git_object), /* TODO: sizeof(git_blob) */ + sizeof(git_blob), sizeof(git_tag) }; @@ -371,6 +372,10 @@ int git_object_write(git_object *object) error = git_tag__writeback((git_tag *)object, source); break; + case GIT_OBJ_BLOB: + error = git_blob__writeback((git_blob *)object, source); + break; + default: error = GIT_ERROR; break; @@ -404,6 +409,10 @@ void git_object_free(git_object *object) git_tag__free((git_tag *)object); break; + case GIT_OBJ_BLOB: + git_blob__free((git_blob *)object); + break; + default: free(object); break; @@ -524,8 +533,10 @@ int git_repository_lookup(git_object **object_out, git_repository *repo, const g break; case GIT_OBJ_BLOB: + error = git_blob__parse((git_blob *)object); + break; + default: - /* blobs get no parsing */ break; } @@ -550,5 +561,6 @@ int git_repository_lookup(git_object **object_out, git_repository *repo, const g GIT_NEWOBJECT_TEMPLATE(commit, COMMIT) GIT_NEWOBJECT_TEMPLATE(tag, TAG) GIT_NEWOBJECT_TEMPLATE(tree, TREE) +GIT_NEWOBJECT_TEMPLATE(blob, BLOB) |
