diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/git2.h | 56 | ||||
-rw-r--r-- | src/git2/blob.h | 128 | ||||
-rw-r--r-- | src/git2/commit.h | 184 | ||||
-rw-r--r-- | src/git2/common.h | 163 | ||||
-rw-r--r-- | src/git2/errors.h | 45 | ||||
-rw-r--r-- | src/git2/index.h | 199 | ||||
-rw-r--r-- | src/git2/object.h | 198 | ||||
-rw-r--r-- | src/git2/odb.h | 201 | ||||
-rw-r--r-- | src/git2/odb_backend.h | 77 | ||||
-rw-r--r-- | src/git2/oid.h | 137 | ||||
-rw-r--r-- | src/git2/refs.h | 223 | ||||
-rw-r--r-- | src/git2/repository.h | 183 | ||||
-rw-r--r-- | src/git2/revwalk.h | 136 | ||||
-rw-r--r-- | src/git2/signature.h | 70 | ||||
-rw-r--r-- | src/git2/tag.h | 145 | ||||
-rw-r--r-- | src/git2/thread-utils.h | 80 | ||||
-rw-r--r-- | src/git2/tree.h | 222 | ||||
-rw-r--r-- | src/git2/types.h | 153 | ||||
-rw-r--r-- | src/git2/zlib.h | 58 |
19 files changed, 0 insertions, 2658 deletions
diff --git a/src/git2.h b/src/git2.h deleted file mode 100644 index e6042d05..00000000 --- a/src/git2.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, - * as published by the Free Software Foundation. - * - * In addition to the permissions in the GNU General Public License, - * the authors give you unlimited permission to link the compiled - * version of this file into combinations with other programs, - * and to distribute those combinations without any restriction - * coming from the use of this file. (The General Public License - * restrictions do apply in other respects; for example, they cover - * modification of the file, and distribution when not linked into - * a combined executable.) - * - * This file is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDE_git_git_h__ -#define INCLUDE_git_git_h__ - -#define LIBGIT2_VERSION "0.4.0" -#define LIBGIT2_VER_MAJOR 0 -#define LIBGIT2_VER_MINOR 4 -#define LIBGIT2_VER_REVISION 0 - -#include "git2/common.h" -#include "git2/errors.h" -#include "git2/zlib.h" - -#include "git2/types.h" - -#include "git2/oid.h" -#include "git2/signature.h" -#include "git2/odb.h" - -#include "git2/repository.h" -#include "git2/revwalk.h" -#include "git2/refs.h" - -#include "git2/object.h" -#include "git2/blob.h" -#include "git2/commit.h" -#include "git2/tag.h" -#include "git2/tree.h" - -#include "git2/index.h" - -#endif diff --git a/src/git2/blob.h b/src/git2/blob.h deleted file mode 100644 index b527d61f..00000000 --- a/src/git2/blob.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, - * as published by the Free Software Foundation. - * - * In addition to the permissions in the GNU General Public License, - * the authors give you unlimited permission to link the compiled - * version of this file into combinations with other programs, - * and to distribute those combinations without any restriction - * coming from the use of this file. (The General Public License - * restrictions do apply in other respects; for example, they cover - * modification of the file, and distribution when not linked into - * a combined executable.) - * - * This file is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDE_git_blob_h__ -#define INCLUDE_git_blob_h__ - -#include "common.h" -#include "types.h" -#include "oid.h" -#include "object.h" - -/** - * @file git2/blob.h - * @brief Git blob load and write routines - * @defgroup git_blob Git blob load and write routines - * @ingroup Git - * @{ - */ -GIT_BEGIN_DECL - -/** - * Lookup a blob object from a repository. - * The generated blob object is owned by the revision - * repo and shall not be freed by the user. - * - * @param blob pointer to the looked up blob - * @param repo the repo to use when locating the blob. - * @param id identity of the blob to locate. - * @return 0 on success; error code otherwise - */ -GIT_INLINE(int) git_blob_lookup(git_blob **blob, git_repository *repo, const git_oid *id) -{ - return git_object_lookup((git_object **)blob, repo, id, GIT_OBJ_BLOB); -} - -/** - * Create a new in-memory git_blob. - * - * The blob object must be manually filled using - * the 'set_rawcontent' methods before it can - * be written back to disk. - * - * @param blob pointer to the new blob - * @param repo The repository where the object will reside - * @return 0 on success; error code otherwise - */ -GIT_INLINE(int) git_blob_new(git_blob **blob, git_repository *repo) -{ - return git_object_new((git_object **)blob, repo, GIT_OBJ_BLOB); -} - -/** - * Fill a blob with the contents inside - * the pointed file. - * - * @param blob pointer to the new blob - * @param filename name of the file to read - * @return 0 on success; error code otherwise - */ -GIT_EXTERN(int) git_blob_set_rawcontent_fromfile(git_blob *blob, const char *filename); - -/** - * Fill a blob with the contents inside - * the pointed buffer - * - * @param blob pointer to the blob - * @param buffer buffer with the contents for the blob - * @param len size of the buffer - * @return 0 on success; error code otherwise - */ -GIT_EXTERN(int) git_blob_set_rawcontent(git_blob *blob, const void *buffer, size_t len); - -/** - * Get a read-only buffer with the raw content of a blob. - * - * A pointer to the raw content of a blob is returned; - * this pointer is owned internally by the object and shall - * not be free'd. The pointer may be invalidated at a later - * time (e.g. when changing the contents of the blob). - * - * @param blob pointer to the blob - * @return the pointer; NULL if the blob has no contents - */ -GIT_EXTERN(const char *) git_blob_rawcontent(git_blob *blob); - -/** - * Get the size in bytes of the contents of a blob - * - * @param blob pointer to the blob - * @return size on bytes - */ -GIT_EXTERN(int) git_blob_rawsize(git_blob *blob); - -/** - * Read a file from the working folder of a repository - * and write it to the Object Database as a loose blob, - * if such doesn't exist yet. - * - * @param written_id return the id of the written blob - * @param repo repository where the blob will be written - * @param path file from which the blob will be created - */ -GIT_EXTERN(int) git_blob_writefile(git_oid *written_id, git_repository *repo, const char *path); - -/** @} */ -GIT_END_DECL -#endif diff --git a/src/git2/commit.h b/src/git2/commit.h deleted file mode 100644 index 21836dbb..00000000 --- a/src/git2/commit.h +++ /dev/null @@ -1,184 +0,0 @@ -/* - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, - * as published by the Free Software Foundation. - * - * In addition to the permissions in the GNU General Public License, - * the authors give you unlimited permission to link the compiled - * version of this file into combinations with other programs, - * and to distribute those combinations without any restriction - * coming from the use of this file. (The General Public License - * restrictions do apply in other respects; for example, they cover - * modification of the file, and distribution when not linked into - * a combined executable.) - * - * This file is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDE_git_commit_h__ -#define INCLUDE_git_commit_h__ - -#include "common.h" -#include "types.h" -#include "oid.h" -#include "object.h" - -/** - * @file git2/commit.h - * @brief Git commit parsing, formatting routines - * @defgroup git_commit Git commit parsing, formatting routines - * @ingroup Git - * @{ - */ -GIT_BEGIN_DECL - -/** - * Lookup a commit object from a repository. - * The generated commit object is owned by the revision - * repo and shall not be freed by the user. - * - * @param commit pointer to the looked up commit - * @param repo the repo to use when locating the commit. - * @param id identity of the commit to locate. If the object is - * an annotated tag it will be peeled back to the commit. - * @return 0 on success; error code otherwise - */ -GIT_INLINE(int) git_commit_lookup(git_commit **commit, git_repository *repo, const git_oid *id) -{ - return git_object_lookup((git_object **)commit, repo, id, GIT_OBJ_COMMIT); -} - -/** - * Create a new in-memory git_commit. - * - * The commit object must be manually filled using - * setter methods before it can be written to its - * repository. - * - * @param commit pointer to the new commit - * @param repo The repository where the object will reside - * @return 0 on success; error code otherwise - */ -GIT_INLINE(int) git_commit_new(git_commit **commit, git_repository *repo) -{ - return git_object_new((git_object **)commit, repo, GIT_OBJ_COMMIT); -} - -/** - * Get the id of a commit. - * @param commit a previously loaded commit. - * @return object identity for the commit. - */ -GIT_EXTERN(const git_oid *) git_commit_id(git_commit *commit); - -/** - * Get the short (one line) message of a commit. - * @param commit a previously loaded commit. - * @return the short message of a commit - */ -GIT_EXTERN(const char *) git_commit_message_short(git_commit *commit); - -/** - * Get the full message of a commit. - * @param commit a previously loaded commit. - * @return the message of a commit - */ -GIT_EXTERN(const char *) git_commit_message(git_commit *commit); - -/** - * Get the commit time (i.e. committer time) of a commit. - * @param commit a previously loaded commit. - * @return the time of a commit - */ -GIT_EXTERN(time_t) git_commit_time(git_commit *commit); - -/** - * Get the commit timezone offset (i.e. committer's preferred timezone) of a commit. - * @param commit a previously loaded commit. - * @return positive or negative timezone offset, in minutes from UTC - */ -GIT_EXTERN(int) git_commit_time_offset(git_commit *commit); - -/** - * Get the committer of a commit. - * @param commit a previously loaded commit. - * @return the committer of a commit - */ -GIT_EXTERN(const git_signature *) git_commit_committer(git_commit *commit); - -/** - * Get the author of a commit. - * @param commit a previously loaded commit. - * @return the author of a commit - */ -GIT_EXTERN(const git_signature *) git_commit_author(git_commit *commit); - -/** - * Get the tree pointed to by a commit. - * @param commit a previously loaded commit. - * @return the tree of a commit - */ -GIT_EXTERN(const git_tree *) git_commit_tree(git_commit *commit); - -/** - * Get the number of parents of this commit - * - * @param commit a previously loaded commit. - * @return integer of count of parents - */ -GIT_EXTERN(unsigned int) git_commit_parentcount(git_commit *commit); - -/** - * Get the specified parent of the commit. - * @param commit a previously loaded commit. - * @param n the position of the entry - * @return a pointer to the commit; NULL if out of bounds - */ -GIT_EXTERN(git_commit *) git_commit_parent(git_commit *commit, unsigned int n); - -/** - * Add a new parent commit to an existing commit - * @param commit the commit object - * @param new_parent the new commit which will be a parent - * @return 0 on success; error code otherwise - */ -GIT_EXTERN(int) git_commit_add_parent(git_commit *commit, git_commit *new_parent); - -/** - * Set the message of a commit - * @param commit the commit object - * @param message the new message - */ -GIT_EXTERN(void) git_commit_set_message(git_commit *commit, const char *message); - -/** - * Set the committer of a commit - * @param commit the commit object - * @param author_sig signature of the committer - */ -GIT_EXTERN(void) git_commit_set_committer(git_commit *commit, const git_signature *committer_sig); - -/** - * Set the author of a commit - * @param commit the commit object - * @param author_sig signature of the author - */ -GIT_EXTERN(void) git_commit_set_author(git_commit *commit, const git_signature *author_sig); - -/** - * Set the tree which is pointed to by a commit - * @param commit the commit object - * @param tree the new tree - */ -GIT_EXTERN(void) git_commit_set_tree(git_commit *commit, git_tree *tree); - -/** @} */ -GIT_END_DECL -#endif diff --git a/src/git2/common.h b/src/git2/common.h deleted file mode 100644 index 34efe808..00000000 --- a/src/git2/common.h +++ /dev/null @@ -1,163 +0,0 @@ -/* - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, - * as published by the Free Software Foundation. - * - * In addition to the permissions in the GNU General Public License, - * the authors give you unlimited permission to link the compiled - * version of this file into combinations with other programs, - * and to distribute those combinations without any restriction - * coming from the use of this file. (The General Public License - * restrictions do apply in other respects; for example, they cover - * modification of the file, and distribution when not linked into - * a combined executable.) - * - * This file is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDE_git_common_h__ -#define INCLUDE_git_common_h__ - -#include "thread-utils.h" -#include <time.h> - -#ifdef __cplusplus -# define GIT_BEGIN_DECL extern "C" { -# define GIT_END_DECL } -#else - /** Start declarations in C mode */ -# define GIT_BEGIN_DECL /* empty */ - /** End declarations in C mode */ -# define GIT_END_DECL /* empty */ -#endif - -/** Declare a public function exported for application use. */ -#ifdef __GNUC__ -# define GIT_EXTERN(type) extern \ - __attribute__((visibility("default"))) \ - type -#elif defined(_MSC_VER) -# define GIT_EXTERN(type) __declspec(dllexport) type -#else -# define GIT_EXTERN(type) extern type -#endif - -/** Declare a public TLS symbol exported for application use. */ -#ifdef __GNUC__ -# define GIT_EXTERN_TLS(type) extern \ - __attribute__((visibility("default"))) \ - GIT_TLS \ - type -#elif defined(_MSC_VER) -# define GIT_EXTERN_TLS(type) __declspec(dllexport) GIT_TLS type -#else -# define GIT_EXTERN_TLS(type) extern GIT_TLS type -#endif - -/** Declare a function as always inlined. */ -#if defined(_MSC_VER) -# define GIT_INLINE(type) static __inline type -#else -# define GIT_INLINE(type) static inline type -#endif - -/** Declare a function's takes printf style arguments. */ -#ifdef __GNUC__ -# define GIT_FORMAT_PRINTF(a,b) __attribute__((format (printf, a, b))) -#else -# define GIT_FORMAT_PRINTF(a,b) /* empty */ -#endif - -/** - * @file git2/common.h - * @brief Git common platform definitions - * @defgroup git_common Git common platform definitions - * @ingroup Git - * @{ - */ - -/** Operation completed successfully. */ -#define GIT_SUCCESS 0 - -/** - * Operation failed, with unspecified reason. - * This value also serves as the base error code; all other - * error codes are subtracted from it such that all errors - * are < 0, in typical POSIX C tradition. - */ -#define GIT_ERROR -1 - -/** Input was not a properly formatted Git object id. */ -#define GIT_ENOTOID (GIT_ERROR - 1) - -/** Input does not exist in the scope searched. */ -#define GIT_ENOTFOUND (GIT_ERROR - 2) - -/** Not enough space available. */ -#define GIT_ENOMEM (GIT_ERROR - 3) - -/** Consult the OS error information. */ -#define GIT_EOSERR (GIT_ERROR - 4) - -/** The specified object is of invalid type */ -#define GIT_EOBJTYPE (GIT_ERROR - 5) - -/** The specified object has its data corrupted */ -#define GIT_EOBJCORRUPTED (GIT_ERROR - 6) - -/** The specified repository is invalid */ -#define GIT_ENOTAREPO (GIT_ERROR - 7) - -/** The object type is invalid or doesn't match */ -#define GIT_EINVALIDTYPE (GIT_ERROR - 8) - -/** The object cannot be written that because it's missing internal data */ -#define GIT_EMISSINGOBJDATA (GIT_ERROR - 9) - -/** The packfile for the ODB is corrupted */ -#define GIT_EPACKCORRUPTED (GIT_ERROR - 10) - -/** Failed to adquire or release a file lock */ -#define GIT_EFLOCKFAIL (GIT_ERROR - 11) - -/** The Z library failed to inflate/deflate an object's data */ -#define GIT_EZLIB (GIT_ERROR - 12) - -/** The queried object is currently busy */ -#define GIT_EBUSY (GIT_ERROR - 13) - -/** The index file is not backed up by an existing repository */ -#define GIT_EBAREINDEX (GIT_ERROR - 14) - -/** The name of the reference is not valid */ -#define GIT_EINVALIDREFNAME (GIT_ERROR - 15) - -/** The specified reference has its data corrupted */ -#define GIT_EREFCORRUPTED (GIT_ERROR - 16) - -/** The specified symbolic reference is too deeply nested */ -#define GIT_ETOONESTEDSYMREF (GIT_ERROR - 17) - -/** The pack-refs file is either corrupted of its format is not currently supported */ -#define GIT_EPACKEDREFSCORRUPTED (GIT_ERROR - 18) - -/** The path is invalid */ -#define GIT_EINVALIDPATH (GIT_ERROR - 19) - -/** The revision walker is empty; there are no more commits left to iterate */ -#define GIT_EREVWALKOVER (GIT_ERROR - 20) - -/** The state of the reference is not valid */ -#define GIT_EINVALIDREFSTATE (GIT_ERROR - 21) - -GIT_BEGIN_DECL -/** @} */ -GIT_END_DECL -#endif diff --git a/src/git2/errors.h b/src/git2/errors.h deleted file mode 100644 index 627e67c7..00000000 --- a/src/git2/errors.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, - * as published by the Free Software Foundation. - * - * In addition to the permissions in the GNU General Public License, - * the authors give you unlimited permission to link the compiled - * version of this file into combinations with other programs, - * and to distribute those combinations without any restriction - * coming from the use of this file. (The General Public License - * restrictions do apply in other respects; for example, they cover - * modification of the file, and distribution when not linked into - * a combined executable.) - * - * This file is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDE_git_errors_h__ -#define INCLUDE_git_errors_h__ - -/** - * @file git2/errors.h - * @brief Git error handling routines and variables - * @ingroup Git - * @{ - */ -GIT_BEGIN_DECL - -/** - * strerror() for the Git library - * @param num The error code to explain - * @return a string explaining the error code - */ -GIT_EXTERN(const char *) git_strerror(int num); - -/** @} */ -GIT_END_DECL -#endif diff --git a/src/git2/index.h b/src/git2/index.h deleted file mode 100644 index 605740c1..00000000 --- a/src/git2/index.h +++ /dev/null @@ -1,199 +0,0 @@ -/* - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, - * as published by the Free Software Foundation. - * - * In addition to the permissions in the GNU General Public License, - * the authors give you unlimited permission to link the compiled - * version of this file into combinations with other programs, - * and to distribute those combinations without any restriction - * coming from the use of this file. (The General Public License - * restrictions do apply in other respects; for example, they cover - * modification of the file, and distribution when not linked into - * a combined executable.) - * - * This file is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDE_git_index_h__ -#define INCLUDE_git_index_h__ - -#include "common.h" -#include "types.h" -#include "oid.h" - -/** - * @file git2/index.h - * @brief Git index parsing and manipulation routines - * @defgroup git_index Git index parsing and manipulation routines - * @ingroup Git - * @{ - */ -GIT_BEGIN_DECL - -#define GIT_IDXENTRY_NAMEMASK (0x0fff) -#define GIT_IDXENTRY_STAGEMASK (0x3000) -#define GIT_IDXENTRY_EXTENDED (0x4000) -#define GIT_IDXENTRY_VALID (0x8000) -#define GIT_IDXENTRY_STAGESHIFT 12 - -/** Time used in a git index entry */ -typedef struct { - git_time_t seconds; - /* nsec should not be stored as time_t compatible */ - unsigned int nanoseconds; -} git_index_time; - -/** Memory representation of a file entry in the index. */ -typedef struct git_index_entry { - git_index_time ctime; - git_index_time mtime; - - unsigned int dev; - unsigned int ino; - unsigned int mode; - unsigned int uid; - unsigned int gid; - git_off_t file_size; - - git_oid oid; - - unsigned short flags; - unsigned short flags_extended; - - char *path; -} git_index_entry; - - -/** - * Create a new Git index object as a memory representation - * of the Git index file in 'index_path', without a repository - * to back it. - * - * Since there is no ODB behind this index, any Index methods - * which rely on the ODB (e.g. index_add) will fail with the - * GIT_EBAREINDEX error code. - * - * @param index the pointer for the new index - * @param index_path the path to the index file in disk - * @return 0 on success; error code otherwise - */ -GIT_EXTERN(int) git_index_open_bare(git_index **index, const char *index_path); - -/** - * Open the Index inside the git repository pointed - * by 'repo'. - * - * @param repo the git repo which owns the index - * @param index_path the path to the index file in disk - * @return 0 on success; error code otherwise - */ -GIT_EXTERN(int) git_index_open_inrepo(git_index **index, git_repository *repo); - -/** - * Clear the contents (all the entries) of an index object. - * This clears the index object in memory; changes must be manually - * written to disk for them to take effect. - * - * @param index an existing index object - */ -GIT_EXTERN(void) git_index_clear(git_index *index); - -/** - * Free an existing index object. - * - * @param index an existing index object - */ -GIT_EXTERN(void) git_index_free(git_index *index); - -/** - * Update the contents of an existing index object in memory - * by reading from the hard disk. - * - * @param index an existing index object - * @return 0 on success, otherwise an error code - */ -GIT_EXTERN(int) git_index_read(git_index *index); - -/** - * Write an existing index object from memory back to disk - * using an atomic file lock. - * - * @param index an existing index object - * @return 0 on success, otherwise an error code - */ -GIT_EXTERN(int) git_index_write(git_index *index); - -/** - * Find the first index of any entires which point to given - * path in the Git index. - * - * @param index an existing index object - * @param path path to search - * @return an index >= 0 if found, -1 otherwise - */ -GIT_EXTERN(int) git_index_find(git_index *index, const char *path); - -/** - * Add or update an index entry from a file in disk. - * - * @param index an existing index object - * @param path filename to add - * @param stage stage for the entry - * @return 0 on success, otherwise an error code - */ -GIT_EXTERN(int) git_index_add(git_index *index, const char *path, int stage); - -/** - * Remove an entry from the index - * - * @param index an existing index object - * @param position position of the entry to remove - * @return 0 on success, otherwise an error code - */ -GIT_EXTERN(int) git_index_remove(git_index *index, int position); - -/** - * Insert an entry into the index. - * A full copy (including the 'path' string) of the given - * 'source_entry' will be inserted on the index; if the index - * already contains an entry for the same path, the entry - * will be updated. - * - * @param index an existing index object - * @param source_entry new entry object - * @return 0 on success, otherwise an error code - */ -GIT_EXTERN(int) git_index_insert(git_index *index, const git_index_entry *source_entry); - -/** - * Get a pointer to one of the entries in the index - * - * This entry can be modified, and the changes will be written - * back to disk on the next write() call. - * - * @param index an existing index object - * @param n the position of the entry - * @return a pointer to the entry; NULL if out of bounds - */ -GIT_EXTERN(git_index_entry *) git_index_get(git_index *index, int n); - -/** - * Get the count of entries currently in the index - * - * @param index an existing index object - * @return integer of count of current entries - */ -GIT_EXTERN(unsigned int) git_index_entrycount(git_index *index); - - -/** @} */ -GIT_END_DECL -#endif diff --git a/src/git2/object.h b/src/git2/object.h deleted file mode 100644 index af0f014e..00000000 --- a/src/git2/object.h +++ /dev/null @@ -1,198 +0,0 @@ -/* - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, - * as published by the Free Software Foundation. - * - * In addition to the permissions in the GNU General Public License, - * the authors give you unlimited permission to link the compiled - * version of this file into combinations with other programs, - * and to distribute those combinations without any restriction - * coming from the use of this file. (The General Public License - * restrictions do apply in other respects; for example, they cover - * modification of the file, and distribution when not linked into - * a combined executable.) - * - * This file is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDE_git_object_h__ -#define INCLUDE_git_object_h__ - -#include "common.h" -#include "types.h" -#include "oid.h" - -/** - * @file git2/object.h - * @brief Git revision object management routines - * @defgroup git_object Git revision object management routines - * @ingroup Git - * @{ - */ -GIT_BEGIN_DECL - -/** - * Lookup a reference to one of the objects in a repostory. - * - * The generated reference is owned by the repository and - * should not be freed by the user. - * - * The 'type' parameter must match the type of the object - * in the odb; the method will fail otherwise. - * The special value 'GIT_OBJ_ANY' may be passed to let - * the method guess the object's type. - * - * @param object pointer to the looked-up object - * @param repo the repository to look up the object - * @param id the unique identifier for the object - * @param type the type of the object - * @return a reference to the object - */ -GIT_EXTERN(int) git_object_lookup(git_object **object, git_repository *repo, const git_oid *id, git_otype type); - -/** - * Create a new in-memory repository object with - * the given type. - * - * The object's attributes can be filled in using the - * corresponding setter methods. - * - * The object will be written back to given git_repository - * when the git_object_write() function is called; objects - * cannot be written to disk until all their main - * attributes have been properly filled. - * - * Objects are instantiated with no SHA1 id; their id - * will be automatically generated when writing to the - * repository. - * - * @param object pointer to the new object - * @parem repo Repository where the object belongs - * @param type Type of the object to be created - * @return the new object - */ -GIT_EXTERN(int) git_object_new(git_object **object, git_repository *repo, git_otype type); - - -/** - * Write back an object to disk. - * - * The object will be written to its corresponding - * repository. - * - * If the object has no changes since it was first - * read from the repository, no actions will take place. - * - * If the object has been modified since it was read from - * the repository, or it has been created from scratch - * in memory, it will be written to the repository and - * its SHA1 ID will be updated accordingly. - * - * @param object Git object to write back - * @return 0 on success; otherwise an error code - */ -GIT_EXTERN(int) git_object_write(git_object *object); - -/** - * Get the id (SHA1) of a repository object - * - * In-memory objects created by git_object_new() do not - * have a SHA1 ID until they are written on a repository. - * - * @param obj the repository object - * @return the SHA1 id - */ -GIT_EXTERN(const git_oid *) git_object_id(const git_object *obj); - -/** - * Get the object type of an object - * - * @param obj the repository object - * @return the object's type - */ -GIT_EXTERN(git_otype) git_object_type(const git_object *obj); - -/** - * Get the repository that owns this object - * - * @param obj the object - * @return the repository who owns this object - */ -GIT_EXTERN(git_repository *) git_object_owner(const git_object *obj); - -/** - * Close an open object - * - * This method instructs the library to close an existing - * object; note that git_objects are owned by the repository - * and are reference counted, so the object may or may not be - * freed after this library call, depending on whether any other - * objects still depend on it. - * - * IMPORTANT: - * It is *not* necessary to call this method when you stop using - * an object, since all object memory is automatically reclaimed - * by the repository when it is freed. - * - * Forgetting to call `git_object_close` does not cause memory - * leaks, but it's is recommended to close as soon as possible - * the biggest objects (e.g. blobs) to prevent wasting memory - * space. - * - * @param object the object to close - */ -GIT_EXTERN(void) git_object_close(git_object *object); - -/** - * Convert an object type to it's string representation. - * - * The result is a pointer to a string in static memory and - * should not be free()'ed. - * - * @param type object type to convert. - * @return the corresponding string representation. - */ -GIT_EXTERN(const char *) git_object_type2string(git_otype type); - -/** - * Convert a string object type representation to it's git_otype. - * - * @param str the string to convert. - * @return the corresponding git_otype. - */ -GIT_EXTERN(git_otype) git_object_string2type(const char *str); - -/** - * Determine if the given git_otype is a valid loose object type. - * - * @param type object type to test. - * @return true if the type represents a valid loose object type, - * false otherwise. - */ -GIT_EXTERN(int) git_object_typeisloose(git_otype type); - -/** - * Get the size in bytes for the structure which - * acts as an in-memory representation of any given - * object type. - * - * For all the core types, this would the equivalent - * of calling `sizeof(git_commit)` if the core types - * were not opaque on the external API. - * - * @param type object type to get its size - * @return size in bytes of the object - */ -GIT_EXTERN(size_t) git_object__size(git_otype type); - -/** @} */ -GIT_END_DECL - -#endif diff --git a/src/git2/odb.h b/src/git2/odb.h deleted file mode 100644 index 0d285897..00000000 --- a/src/git2/odb.h +++ /dev/null @@ -1,201 +0,0 @@ -/* - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, - * as published by the Free Software Foundation. - * - * In addition to the permissions in the GNU General Public License, - * the authors give you unlimited permission to link the compiled - * version of this file into combinations with other programs, - * and to distribute those combinations without any restriction - * coming from the use of this file. (The General Public License - * restrictions do apply in other respects; for example, they cover - * modification of the file, and distribution when not linked into - * a combined executable.) - * - * This file is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDE_git_odb_h__ -#define INCLUDE_git_odb_h__ - -#include "common.h" -#include "types.h" -#include "oid.h" - -/** - * @file git2/odb.h - * @brief Git object database routines - * @defgroup git_odb Git object database routines - * @ingroup Git - * @{ - */ -GIT_BEGIN_DECL - -/** - * Create a new object database with no backends. - * - * Before the ODB can be used for read/writing, a custom database - * backend must be manually added using `git_odb_add_backend()` - * - * @param out location to store the database pointer, if opened. - * Set to NULL if the open failed. - * @return GIT_SUCCESS if the database was created; otherwise an error - * code describing why the open was not possible. - */ -GIT_EXTERN(int) git_odb_new(git_odb **out); - -/** - * Create a new object database and automatically add - * the two default backends: - * - * - git_odb_backend_loose: read and write loose object files - * from disk, assuming `objects_dir` as the Objects folder - * - * - git_odb_backend_pack: read objects from packfiles, - * assuming `objects_dir` as the Objects folder which - * contains a 'pack/' folder with the corresponding data - * - * @param out location to store the database pointer, if opened. - * Set to NULL if the open failed. - * @param objects_dir path of the backends' "objects" directory. - * @return GIT_SUCCESS if the database opened; otherwise an error - * code describing why the open was not possible. - */ -GIT_EXTERN(int) git_odb_open(git_odb **out, const char *objects_dir); - -/** - * Add a custom backend to an existing Object DB - * - * Read <odb_backends.h> for more information. - * - * @param odb database to add the backend to - * @paramm backend pointer to a git_odb_backend instance - * @return 0 on sucess; error code otherwise - */ -GIT_EXTERN(int) git_odb_add_backend(git_odb *odb, git_odb_backend *backend, int priority); - -/** - * Add a custom backend to an existing Object DB; this - * backend will work as an alternate. - * - * Alternate backends are always checked for objects *after* - * all the main backends have been exhausted. - * - * Writing is disabled on alternate backends. - * - * Read <odb_backends.h> for more information. - * - * @param odb database to add the backend to - * @paramm backend pointer to a git_odb_backend instance - * @return 0 on sucess; error code otherwise - */ -GIT_EXTERN(int) git_odb_add_alternate(git_odb *odb, git_odb_backend *backend, int priority); - -/** - * Close an open object database. - * @param db database pointer to close. If NULL no action is taken. - */ -GIT_EXTERN(void) git_odb_close(git_odb *db); - -/** An object read from the database. */ -typedef struct { - void *data; /**< Raw, decompressed object data. */ - size_t len; /**< Total number of bytes in data. */ - git_otype type; /**< Type of this object. */ -} git_rawobj; - -/** - * Read an object from the database. - * - * If GIT_ENOTFOUND then out->data is set to NULL. - * - * @param out object descriptor to populate upon reading. - * @param db database to search for the object in. - * @param id identity of the object to read. - * @return - * - GIT_SUCCESS if the object was read; - * - GIT_ENOTFOUND if the object is not in the database. - */ -GIT_EXTERN(int) git_odb_read(git_rawobj *out, git_odb *db, const git_oid *id); - -/** - * Read the header of an object from the database, without - * reading its full contents. - * - * Only the 'type' and 'len' fields of the git_rawobj structure - * are filled. The 'data' pointer will always be NULL. - * - * The raw object pointed by 'out' doesn't need to be manually - * closed with git_rawobj_close(). - * - * @param out object descriptor to populate upon reading. - * @param db database to search for the object in. - * @param id identity of the object to read. - * @return - * - GIT_SUCCESS if the object was read; - * - GIT_ENOTFOUND if the object is not in the database. - */ -GIT_EXTERN(int) git_odb_read_header(git_rawobj *out, git_odb *db, const git_oid *id); - -/** - * Write an object to the database. - * - * @param id identity of the object written. - * @param db database to which the object should be written. - * @param obj object descriptor for the object to write. - * @return - * - GIT_SUCCESS if the object was written; - * - GIT_ERROR otherwise. - */ -GIT_EXTERN(int) git_odb_write(git_oid *id, git_odb *db, git_rawobj *obj); - -/** - * Determine if the given object can be found in the object database. - * - * @param db database to be searched for the given object. - * @param id the object to search for. - * @return - * - true, if the object was found - * - false, otherwise - */ -GIT_EXTERN(int) git_odb_exists(git_odb *db, const git_oid *id); - - - - - -/** - * Determine the object-ID (sha1 hash) of the given git_rawobj. - * - * The input obj must be a valid loose object type and the data - * pointer must not be NULL, unless the len field is also zero. - * - * @param id the resulting object-ID. - * @param obj the object whose hash is to be determined. - * @return - * - GIT_SUCCESS if the object-ID was correctly determined. - * - GIT_ERROR if the given object is malformed. - */ -GIT_EXTERN(int) git_rawobj_hash(git_oid *id, git_rawobj *obj); - -/** - * Release all memory used by the obj structure. - * - * As a result of this call, obj->data will be set to NULL. - * - * If obj->data is already NULL, nothing happens. - * - * @param obj object descriptor to free. - */ -GIT_EXTERN(void) git_rawobj_close(git_rawobj *obj); - -/** @} */ -GIT_END_DECL -#endif diff --git a/src/git2/odb_backend.h b/src/git2/odb_backend.h deleted file mode 100644 index 0e817eb3..00000000 --- a/src/git2/odb_backend.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, - * as published by the Free Software Foundation. - * - * In addition to the permissions in the GNU General Public License, - * the authors give you unlimited permission to link the compiled - * version of this file into combinations with other programs, - * and to distribute those combinations without any restriction - * coming from the use of this file. (The General Public License - * restrictions do apply in other respects; for example, they cover - * modification of the file, and distribution when not linked into - * a combined executable.) - * - * This file is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDE_git_odb_backend_h__ -#define INCLUDE_git_odb_backend_h__ - -#include "common.h" -#include "types.h" -#include "oid.h" -#include "odb.h" - -/** - * @file git2/backend.h - * @brief Git custom backend functions - * @defgroup git_backend Git custom backend API - * @ingroup Git - * @{ - */ -GIT_BEGIN_DECL - -/** An instance for a custom backend */ -struct git_odb_backend { - git_odb *odb; - - int (* read)( - git_rawobj *, - struct git_odb_backend *, - const git_oid *); - - int (* read_header)( - git_rawobj *, - struct git_odb_backend *, - const git_oid *); - - int (* write)( - git_oid *id, - struct git_odb_backend *, - git_rawobj *obj); - - int (* exists)( - struct git_odb_backend *, - const git_oid *); - - void (* free)(struct git_odb_backend *); -}; - -GIT_EXTERN(int) git_odb_backend_pack(git_odb_backend **backend_out, const char *objects_dir); -GIT_EXTERN(int) git_odb_backend_loose(git_odb_backend **backend_out, const char *objects_dir); - -#ifdef GIT2_SQLITE_BACKEND -GIT_EXTERN(int) git_odb_backend_sqlite(git_odb_backend **backend_out, const char *sqlite_db); -#endif - -GIT_END_DECL - -#endif diff --git a/src/git2/oid.h b/src/git2/oid.h deleted file mode 100644 index 5cac46f3..00000000 --- a/src/git2/oid.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, - * as published by the Free Software Foundation. - * - * In addition to the permissions in the GNU General Public License, - * the authors give you unlimited permission to link the compiled - * version of this file into combinations with other programs, - * and to distribute those combinations without any restriction - * coming from the use of this file. (The General Public License - * restrictions do apply in other respects; for example, they cover - * modification of the file, and distribution when not linked into - * a combined executable.) - * - * This file is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDE_git_oid_h__ -#define INCLUDE_git_oid_h__ - -#include "common.h" -#include "types.h" - -/** - * @file git2/oid.h - * @brief Git object id routines - * @defgroup git_oid Git object id routines - * @ingroup Git - * @{ - */ -GIT_BEGIN_DECL - -/** Size (in bytes) of a raw/binary oid */ -#define GIT_OID_RAWSZ 20 - -/** Size (in bytes) of a hex formatted oid */ -#define GIT_OID_HEXSZ (GIT_OID_RAWSZ * 2) - -/** Unique identity of any object (commit, tree, blob, tag). */ -typedef struct { - /** raw binary formatted id */ - unsigned char id[GIT_OID_RAWSZ]; -} git_oid; - -/** - * Parse a hex formatted object id into a git_oid. - * @param out oid structure the result is written into. - * @param str input hex string; must be pointing at the start of - * the hex sequence and have at least the number of bytes - * needed for an oid encoded in hex (40 bytes). - * @return GIT_SUCCESS if valid; GIT_ENOTOID on failure. - */ -GIT_EXTERN(int) git_oid_mkstr(git_oid *out, const char *str); - -/** - * Copy an already raw oid into a git_oid structure. - * @param out oid structure the result is written into. - * @param raw the raw input bytes to be copied. - */ -GIT_EXTERN(void) git_oid_mkraw(git_oid *out, const unsigned char *raw); - -/** - * Format a git_oid into a hex string. - * @param str output hex string; must be pointing at the start of - * the hex sequence and have at least the number of bytes - * needed for an oid encoded in hex (40 bytes). Only the - * oid digits are written; a '\\0' terminator must be added - * by the caller if it is required. - * @param oid oid structure to format. - */ -GIT_EXTERN(void) git_oid_fmt(char *str, const git_oid *oid); - -/** - * Format a git_oid into a loose-object path string. - * <p> - * The resulting string is "aa/...", where "aa" is the first two - * hex digitis of the oid and "..." is the remaining 38 digits. - * - * @param str output hex string; must be pointing at the start of - * the hex sequence and have at least the number of bytes - * needed for an oid encoded in hex (41 bytes). Only the - * oid digits are written; a '\\0' terminator must be added - * by the caller if it is required. - * @param oid oid structure to format. - */ -GIT_EXTERN(void) git_oid_pathfmt(char *str, const git_oid *oid); - -/** - * Format a gid_oid into a newly allocated c-string. - * @param oid the oid structure to format - * @return the c-string; NULL if memory is exhausted. Caller must - * deallocate the string with free(). - */ -GIT_EXTERN(char *) git_oid_allocfmt(const git_oid *oid); - -/** - * Format a git_oid into a buffer as a hex format c-string. - * <p> - * If the buffer is smaller than GIT_OID_HEXSZ+1, then the resulting - * oid c-string will be truncated to n-1 characters. If there are - * any input parameter errors (out == NULL, n == 0, oid == NULL), - * then a pointer to an empty string is returned, so that the return - * value can always be printed. - * - * @param out the buffer into which the oid string is output. - * @param n the size of the out buffer. - * @param oid the oid structure to format. - * @return the out buffer pointer, assuming no input parameter - * errors, otherwise a pointer to an empty string. - */ -GIT_EXTERN(char *) git_oid_to_string(char *out, size_t n, const git_oid *oid); - -/** - * Copy an oid from one structure to another. - * @param out oid structure the result is written into. - * @param src oid structure to copy from. - */ -GIT_EXTERN(void) git_oid_cpy(git_oid *out, const git_oid *src); - -/** - * Compare two oid structures. - * @param a first oid structure. - * @param b second oid structure. - * @return <0, 0, >0 if a < b, a == b, a > b. - */ -GIT_EXTERN(int) git_oid_cmp(const git_oid *a, const git_oid *b); - -/** @} */ -GIT_END_DECL -#endif diff --git a/src/git2/refs.h b/src/git2/refs.h deleted file mode 100644 index 1702d7ee..00000000 --- a/src/git2/refs.h +++ /dev/null @@ -1,223 +0,0 @@ -/* - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, - * as published by the Free Software Foundation. - * - * In addition to the permissions in the GNU General Public License, - * the authors give you unlimited permission to link the compiled - * version of this file into combinations with other programs, - * and to distribute those combinations without any restriction - * coming from the use of this file. (The General Public License - * restrictions do apply in other respects; for example, they cover - * modification of the file, and distribution when not linked into - * a combined executable.) - * - * This file is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDE_git_refs_h__ -#define INCLUDE_git_refs_h__ - -#include "common.h" -#include "types.h" -#include "oid.h" - -/** - * @file git2/refs.h - * @brief Git reference management routines - * @defgroup git_reference Git reference management routines - * @ingroup Git - * @{ - */ -GIT_BEGIN_DECL - -/** - * Lookup a reference by its name in a repository. - * - * The generated reference is owned by the repository and - * should not be freed by the user. - * - * @param reference_out pointer to the looked-up reference - * @param repo the repository to look up the reference - * @param name the long name for the reference (e.g. HEAD, ref/heads/master, refs/tags/v0.1.0, ...) - * @return 0 on success; error code otherwise - */ -GIT_EXTERN(int) git_reference_lookup(git_reference **reference_out, git_repository *repo, const char *name); - -/** - * Create a new symbolic reference. - * - * The reference will be created in the repository and written - * to the disk. - * - * This reference is owned by the repository and shall not - * be free'd by the user. - * - * @param ref_out Pointer to the newly created reference - * @param repo Repository where that reference will live - * @param name The name of the reference - * @param target The target of the reference - * @return 0 on success; error code otherwise - */ -GIT_EXTERN(int) git_reference_create_symbolic(git_reference **ref_out, git_repository *repo, const char *name, const char *target); - -/** - * Create a new object id reference. - * - * The reference will be created in the repository and written - * to the disk. - * - * This reference is owned by the repository and shall not - * be free'd by the user. - * - * @param ref_out Pointer to the newly created reference - * @param repo Repository where that reference will live - * @param name The name of the reference - * @param id The object id pointed to by the reference. - * @return 0 on success; error code otherwise - */ -GIT_EXTERN(int) git_reference_create_oid(git_reference **ref_out, git_repository *repo, const char *name, const git_oid *id); - -/** - * Get the OID pointed to by a reference. - * - * Only available if the reference is direct (i.e. not symbolic) - * - * @param ref The reference - * @return a pointer to the oid if available, NULL otherwise - */ -GIT_EXTERN(const git_oid *) git_reference_oid(git_reference *ref); - -/** - * Get full name to the reference pointed by this reference - * - * Only available if the reference is symbolic - * - * @param ref The reference - * @return a pointer to the name if available, NULL otherwise - */ -GIT_EXTERN(const char *) git_reference_target(git_reference *ref); - -/** - * Get the type of a reference - * - * Either direct (GIT_REF_OID) or symbolic (GIT_REF_SYMBOLIC) - * - * @param ref The reference - * @return the type - */ -GIT_EXTERN(git_rtype) git_reference_type(git_reference *ref); - -/** - * Get the full name of a reference - * - * @param ref The reference - * @return the full name for the ref - */ -GIT_EXTERN(const char *) git_reference_name(git_reference *ref); - -/** - * Resolve a symbolic reference - * - * Thie method iteratively peels a symbolic reference - * until it resolves to a direct reference to an OID. - * - * If a direct reference is passed as an argument, - * that reference is returned immediately - * - * @param resolved_ref Pointer to the peeled reference - * @param ref The reference - * @return 0 on success; error code otherwise - */ -GIT_EXTERN(int) git_reference_resolve(git_reference **resolved_ref, git_reference *ref); - -/** - * Get the repository where a reference resides - * - * @param ref The reference - * @return a pointer to the repo - */ -GIT_EXTERN(git_repository *) git_reference_owner(git_reference *ref); - -/** - * Set the symbolic target of a reference. - * - * The reference must be a symbolic reference, otherwise - * this method will fail. - * - * The reference will be automatically updated in - * memory and on disk. - * - * @param ref The reference - * @param target The new target for the reference - * @return 0 on success; error code otherwise - */ -GIT_EXTERN(int) git_reference_set_target(git_reference *ref, const char *target); - -/** - * Set the OID target of a reference. - * - * The reference must be a direct reference, otherwise - * this method will fail. - * - * The reference will be automatically updated in - * memory and on disk. - * - * @param ref The reference - * @param target The new target OID for the reference - * @return 0 on success; error code otherwise - */ -GIT_EXTERN(int) git_reference_set_oid(git_reference *ref, const git_oid *id); - -/** - * Rename an existing reference - * - * This method works for both direct and symbolic references. - * The new name will be checked for validity and may be - * modified into a normalized form. - * - * The refernece will be immediately renamed in-memory - * and on disk. - * - */ -GIT_EXTERN(int) git_reference_rename(git_reference *ref, const char *new_name); - -/** - * Delete an existing reference - * - * This method works for both direct and symbolic references. - * - * The reference will be immediately removed on disk and from - * memory. The given reference pointer will no longer be valid. - * - */ -GIT_EXTERN(int) git_reference_delete(git_reference *ref); - -/** - * Pack all the loose references in the repository - * - * This method will load into the cache all the loose - * references on the repository and update the - * `packed-refs` file with them. - * - * Once the `packed-refs` file has been written properly, - * the loose references will be removed from disk. - * - * WARNING: calling this method may invalidate any existing - * references previously loaded on the cache. - * - * @param repo Repository where the loose refs will be packed - * @return 0 on success; error code otherwise - */ -GIT_EXTERN(int) git_reference_packall(git_repository *repo); - -/** @} */ -GIT_END_DECL -#endif diff --git a/src/git2/repository.h b/src/git2/repository.h deleted file mode 100644 index 5327f8c5..00000000 --- a/src/git2/repository.h +++ /dev/null @@ -1,183 +0,0 @@ -/* - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, - * as published by the Free Software Foundation. - * - * In addition to the permissions in the GNU General Public License, - * the authors give you unlimited permission to link the compiled - * version of this file into combinations with other programs, - * and to distribute those combinations without any restriction - * coming from the use of this file. (The General Public License - * restrictions do apply in other respects; for example, they cover - * modification of the file, and distribution when not linked into - * a combined executable.) - * - * This file is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDE_git_repository_h__ -#define INCLUDE_git_repository_h__ - -#include "common.h" -#include "types.h" -#include "oid.h" - -/** - * @file git2/repository.h - * @brief Git repository management routines - * @defgroup git_repository Git repository management routines - * @ingroup Git - * @{ - */ -GIT_BEGIN_DECL - -/** - * Open a git repository. - * - * The 'path' argument must point to an existing git repository - * folder, e.g. - * - * /path/to/my_repo/.git/ (normal repository) - * objects/ - * index - * HEAD - * - * /path/to/bare_repo/ (bare repository) - * objects/ - * index - * HEAD - * - * The method will automatically detect if 'path' is a normal - * or bare repository or fail is 'path' is neither. - * - * @param repository pointer to the repo which will be opened - * @param path the path to the repository - * @return 0 on success; error code otherwise - */ -GIT_EXTERN(int) git_repository_open(git_repository **repository, const char *path); - - -/** - * Open a git repository by manually specifying all its paths - * - * @param repository pointer to the repo which will be opened - * - * @param git_dir The full path to the repository folder - * e.g. a '.git' folder for live repos, any folder for bare - * Equivalent to $GIT_DIR. - * Cannot be NULL. - * - * @param git_object_directory The full path to the ODB folder. - * the folder where all the loose and packed objects are stored - * Equivalent to $GIT_OBJECT_DIRECTORY. - * If NULL, "$GIT_DIR/objects/" is assumed. - * - * @param git_index_file The full path to the index (dircache) file - * Equivalent to $GIT_INDEX_FILE. - * If NULL, "$GIT_DIR/index" is assumed. - * - * @param git_work_tree The full path to the working tree of the repository, - * if the repository is not bare. - * Equivalent to $GIT_WORK_TREE. - * If NULL, the repository is assumed to be bare. - * - * @return 0 on success; error code otherwise - */ -GIT_EXTERN(int) git_repository_open2(git_repository **repository, - const char *git_dir, - const char *git_object_directory, - const char *git_index_file, - const char *git_work_tree); - - -/** - * Open a git repository by manually specifying its paths and - * the object database it will use. - * - * @param repository pointer to the repo which will be opened - * - * @param git_dir The full path to the repository folder - * e.g. a '.git' folder for live repos, any folder for bare - * Equivalent to $GIT_DIR. - * Cannot be NULL. - * - * @param object_database A pointer to a git_odb created & initialized - * by the user (e.g. with custom backends). This object database - * will be owned by the repository and will be automatically free'd. - * It should not be manually free'd by the user, or this - * git_repository object will become invalid. - * - * @param git_index_file The full path to the index (dircache) file - * Equivalent to $GIT_INDEX_FILE. - * If NULL, "$GIT_DIR/index" is assumed. - * - * @param git_work_tree The full path to the working tree of the repository, - * if the repository is not bare. - * Equivalent to $GIT_WORK_TREE. - * If NULL, the repository is assumed to be bare. - * - * @return 0 on success; error code otherwise - */ - -GIT_EXTERN(int) git_repository_open3(git_repository **repository, - const char *git_dir, - git_odb *object_database, - const char *git_index_file, - const char *git_work_tree); - -/** - * Get the object database behind a Git repository - * - * @param repo a repository object - * @return a pointer to the object db - */ -GIT_EXTERN(git_odb *) git_repository_database(git_repository *repo); - -/** - * Get the Index file of a Git repository - * - * This is a cheap operation; the index is only opened on the first call, - * and subsequent calls only retrieve the previous pointer. - * - * @param index Pointer where to store the index - * @param repo a repository object - * @return 0 on success; error code if the index could not be opened - */ -GIT_EXTERN(int) git_repository_index(git_index **index, git_repository *repo); - -/** - * Free a previously allocated repository - * @param repo repository handle to close. If NULL nothing occurs. - */ -GIT_EXTERN(void) git_repository_free(git_repository *repo); - - -GIT_EXTERN(void) git_repository_free__no_gc(git_repository *repo); - -/** - * Creates a new Git repository in the given folder. - * - * TODO: - * - Reinit the repository - * - Create config files - * - * @param repo_out pointer to the repo which will be created or reinitialized - * @param path the path to the repository - * @param is_bare if true, a Git repository without a working directory is created - * at the pointed path. If false, provided path will be considered as the working - * directory into which the .git directory will be created. - * - * @return 0 on success; error code otherwise - */ -GIT_EXTERN(int) git_repository_init(git_repository **repo_out, const char *path, unsigned is_bare); - -/** @} */ -GIT_END_DECL -#endif diff --git a/src/git2/revwalk.h b/src/git2/revwalk.h deleted file mode 100644 index 84111049..00000000 --- a/src/git2/revwalk.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, - * as published by the Free Software Foundation. - * - * In addition to the permissions in the GNU General Public License, - * the authors give you unlimited permission to link the compiled - * version of this file into combinations with other programs, - * and to distribute those combinations without any restriction - * coming from the use of this file. (The General Public License - * restrictions do apply in other respects; for example, they cover - * modification of the file, and distribution when not linked into - * a combined executable.) - * - * This file is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDE_git_revwalk_h__ -#define INCLUDE_git_revwalk_h__ - -#include "common.h" -#include "types.h" - -/** - * @file git2/revwalk.h - * @brief Git revision traversal routines - * @defgroup git_revwalk Git revision traversal routines - * @ingroup Git - * @{ - */ -GIT_BEGIN_DECL - -/** - * Sort the repository contents in no particular ordering; - * this sorting is arbitrary, implementation-specific - * and subject to change at any time. - * This is the default sorting for new walkers. - */ -#define GIT_SORT_NONE (0) - -/** - * Sort the repository contents in topological order - * (parents before children); this sorting mode - * can be combined with time sorting. - */ -#define GIT_SORT_TOPOLOGICAL (1 << 0) - -/** - * Sort the repository contents by commit time; - * this sorting mode can be combined with - * topological sorting. - */ -#define GIT_SORT_TIME (1 << 1) - -/** - * Iterate through the repository contents in reverse - * order; this sorting mode can be combined with - * any of the above. - */ -#define GIT_SORT_REVERSE (1 << 2) - -/** - * Allocate a new revision walker to iterate through a repo. - * - * @param walker pointer to the new revision walker - * @param repo the repo to walk through - * @return 0 on success; error code otherwise - */ -GIT_EXTERN(int) git_revwalk_new(git_revwalk **walker, git_repository *repo); - -/** - * Reset the walking machinery for reuse. - * @param walker handle to reset. - */ -GIT_EXTERN(void) git_revwalk_reset(git_revwalk *walker); - -/** - * Mark a commit to start traversal from. - * The commit object must belong to the repo which is being walked through. - * - * @param walker the walker being used for the traversal. - * @param commit the commit to start from. - */ -GIT_EXTERN(int) git_revwalk_push(git_revwalk *walk, git_commit *commit); - -/** - * Mark a commit (and its ancestors) uninteresting for the output. - * @param walker the walker being used for the traversal. - * @param commit the commit that will be ignored during the traversal - */ -GIT_EXTERN(int) git_revwalk_hide(git_revwalk *walk, git_commit *commit); - -/** - * Get the next commit from the revision traversal. - * - * @param commit Pointer where to store the next commit - * @param walk the walker to pop the commit from. - * @return GIT_SUCCESS if the next commit was found; - * GIT_EREVWALKOVER if there are no commits left to iterate - */ -GIT_EXTERN(int) git_revwalk_next(git_commit **commit, git_revwalk *walk); - -/** - * Change the sorting mode when iterating through the - * repository's contents. - * Changing the sorting mode resets the walker. - * @param walk the walker being used for the traversal. - * @param sort_mode combination of GIT_RPSORT_XXX flags - */ -GIT_EXTERN(int) git_revwalk_sorting(git_revwalk *walk, unsigned int sort_mode); - -/** - * Free a revwalk previously allocated. - * @param walk traversal handle to close. If NULL nothing occurs. - */ -GIT_EXTERN(void) git_revwalk_free(git_revwalk *walk); - -/** - * Return the repository on which this walker - * is operating. - * - * @param walk the revision walker - * @return the repository being walked - */ -GIT_EXTERN(git_repository *) git_revwalk_repository(git_revwalk *walk); - -/** @} */ -GIT_END_DECL -#endif diff --git a/src/git2/signature.h b/src/git2/signature.h deleted file mode 100644 index 96275aa0..00000000 --- a/src/git2/signature.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, - * as published by the Free Software Foundation. - * - * In addition to the permissions in the GNU General Public License, - * the authors give you unlimited permission to link the compiled - * version of this file into combinations with other programs, - * and to distribute those combinations without any restriction - * coming from the use of this file. (The General Public License - * restrictions do apply in other respects; for example, they cover - * modification of the file, and distribution when not linked into - * a combined executable.) - * - * This file is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDE_git_signature_h__ -#define INCLUDE_git_signature_h__ - -#include "common.h" -#include "types.h" - -/** - * @file git2/signature.h - * @brief Git signature creation - * @defgroup git_signature Git signature creation - * @ingroup Git - * @{ - */ -GIT_BEGIN_DECL - -/** - * Create a new action signature. The signature must be freed - * manually or using git_signature_free - * - * @name name of the person - * @email email of the person - * @time time when the action happened - * @offset timezone offset in minutes for the time - * @return the new sig, NULl on out of memory - */ -GIT_EXTERN(git_signature *) git_signature_new(const char *name, const char *email, time_t time, int offset); - -/** - * Create a copy of an existing signature. - * - * All internal strings are also duplicated. - * @sig signature to duplicated - * @return a copy of sig, NULL on out of memory - */ -GIT_EXTERN(git_signature *) git_signature_dup(const git_signature *sig); - -/** - * Free an existing signature - * - * @sig signature to free - */ -GIT_EXTERN(void) git_signature_free(git_signature *sig); - -/** @} */ -GIT_END_DECL -#endif diff --git a/src/git2/tag.h b/src/git2/tag.h deleted file mode 100644 index 2ca25c8a..00000000 --- a/src/git2/tag.h +++ /dev/null @@ -1,145 +0,0 @@ -/* - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, - * as published by the Free Software Foundation. - * - * In addition to the permissions in the GNU General Public License, - * the authors give you unlimited permission to link the compiled - * version of this file into combinations with other programs, - * and to distribute those combinations without any restriction - * coming from the use of this file. (The General Public License - * restrictions do apply in other respects; for example, they cover - * modification of the file, and distribution when not linked into - * a combined executable.) - * - * This file is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDE_git_tag_h__ -#define INCLUDE_git_tag_h__ - -#include "common.h" -#include "types.h" -#include "oid.h" -#include "object.h" - -/** - * @file git2/tag.h - * @brief Git tag parsing routines - * @defgroup git_tag Git tag management - * @ingroup Git - * @{ - */ -GIT_BEGIN_DECL - -/** - * Lookup a tag object from the repository. - * The generated tag object is owned by the revision - * repo and shall not be freed by the user. - * - * @param tag pointer to the looked up tag - * @param repo the repo to use when locating the tag. - * @param id identity of the tag to locate. - * @return 0 on success; error code otherwise - */ -GIT_INLINE(int) git_tag_lookup(git_tag **tag, git_repository *repo, const git_oid *id) -{ - return git_object_lookup((git_object **)tag, repo, id, (git_otype)GIT_OBJ_TAG); -} - -/** - * Create a new in-memory git_tag. - * - * The tag object must be manually filled using - * setter methods before it can be written to its - * repository. - * - * @param tag pointer to the new tag - * @param repo The repository where the object will reside - * @return 0 on success; error code otherwise - */ -GIT_INLINE(int) git_tag_new(git_tag **tag, git_repository *repo) -{ - return git_object_new((git_object **)tag, repo, (git_otype)GIT_OBJ_TAG); -} - -/** - * Get the id of a tag. - * @param tag a previously loaded tag. - * @return object identity for the tag. - */ -GIT_EXTERN(const git_oid *) git_tag_id(git_tag *tag); - -/** - * Get the tagged object of a tag - * @param tag a previously loaded tag. - * @return reference to a repository object - */ -GIT_EXTERN(const git_object *) git_tag_target(git_tag *t); - -/** - * Get the type of a tag's tagged object - * @param tag a previously loaded tag. - * @return type of the tagged object - */ -GIT_EXTERN(git_otype) git_tag_type(git_tag *t); - -/** - * Get the name of a tag - * @param tag a previously loaded tag. - * @return name of the tag - */ -GIT_EXTERN(const char *) git_tag_name(git_tag *t); - -/** - * Get the tagger (author) of a tag - * @param tag a previously loaded tag. - * @return reference to the tag's author - */ -GIT_EXTERN(const git_signature *) git_tag_tagger(git_tag *t); - -/** - * Get the message of a tag - * @param tag a previously loaded tag. - * @return message of the tag - */ -GIT_EXTERN(const char *) git_tag_message(git_tag *t); - -/** - * Set the target of a tag (i.e. the object that the tag points to) - * @param tag The tag to modify - * @param target the new tagged target - */ -GIT_EXTERN(void) git_tag_set_target(git_tag *tag, git_object *target); - -/** - * Set the name of a tag - * @param tag The tag to modify - * @param name the new name for the tag - */ -GIT_EXTERN(void) git_tag_set_name(git_tag *tag, const char *name); - -/** - * Set the tagger of a tag - * @param tag The tag to modify - * @param tagger_sig signature of the tagging action - */ -GIT_EXTERN(void) git_tag_set_tagger(git_tag *tag, const git_signature *tagger_sig); - -/** - * Set the message of a tag - * @param tag The tag to modify - * @param message the new tagger for the tag - */ -GIT_EXTERN(void) git_tag_set_message(git_tag *tag, const char *message); - -/** @} */ -GIT_END_DECL -#endif diff --git a/src/git2/thread-utils.h b/src/git2/thread-utils.h deleted file mode 100644 index c45a76e9..00000000 --- a/src/git2/thread-utils.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, - * as published by the Free Software Foundation. - * - * In addition to the permissions in the GNU General Public License, - * the authors give you unlimited permission to link the compiled - * version of this file into combinations with other programs, - * and to distribute those combinations without any restriction - * coming from the use of this file. (The General Public License - * restrictions do apply in other respects; for example, they cover - * modification of the file, and distribution when not linked into - * a combined executable.) - * - * This file is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDE_git_thread_utils_h__ -#define INCLUDE_git_thread_utils_h__ - -/* - * How TLS works is compiler+platform dependant - * Sources: http://en.wikipedia.org/wiki/Thread-Specific_Storage - * http://predef.sourceforge.net/precomp.html - */ - -#define GIT_HAS_TLS 1 -#define GIT_HAS_PTHREAD 1 - -#if defined(__APPLE__) && defined(__MACH__) -# undef GIT_TLS - -#elif defined(__GNUC__) || \ - defined(__SUNPRO_C) || \ - defined(__SUNPRO_CC) || \ - defined(__xlc__) || \ - defined(__xlC__) -# define GIT_TLS __thread - -#elif defined(__INTEL_COMPILER) -# if defined(_WIN32) || defined(_WIN32_CE) -# define GIT_TLS __declspec(thread) -# undef GIT_HAS_PTHREAD -# else -# define GIT_TLS __thread -# endif - -#elif defined(_WIN32) || \ - defined(_WIN32_CE) || \ - defined(__BORLANDC__) -# define GIT_TLS __declspec(thread) -# undef GIT_HAS_PTHREAD - -#else -# undef GIT_HAS_TLS -# undef GIT_HAS_PTHREAD -# define GIT_TLS /* nothing: tls vars are thread-global */ -#endif - -/* sparse and cygwin don't grok thread-local variables */ -#if defined(__CHECKER__) || defined(__CYGWIN__) -# undef GIT_HAS_TLS -# undef GIT_TLS -# define GIT_TLS -#endif - -#ifdef GIT_HAS_PTHREAD -# define GIT_THREADS 1 -#else -# undef GIT_THREADS -#endif - -#endif /* INCLUDE_git_thread_utils_h__ */ diff --git a/src/git2/tree.h b/src/git2/tree.h deleted file mode 100644 index 70040f05..00000000 --- a/src/git2/tree.h +++ /dev/null @@ -1,222 +0,0 @@ -/* - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, - * as published by the Free Software Foundation. - * - * In addition to the permissions in the GNU General Public License, - * the authors give you unlimited permission to link the compiled - * version of this file into combinations with other programs, - * and to distribute those combinations without any restriction - * coming from the use of this file. (The General Public License - * restrictions do apply in other respects; for example, they cover - * modification of the file, and distribution when not linked into - * a combined executable.) - * - * This file is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDE_git_tree_h__ -#define INCLUDE_git_tree_h__ - -#include "common.h" -#include "types.h" -#include "oid.h" -#include "object.h" - -/** - * @file git2/tree.h - * @brief Git tree parsing, loading routines - * @defgroup git_tree Git tree parsing, loading routines - * @ingroup Git - * @{ - */ -GIT_BEGIN_DECL - -/** - * Lookup a tree object from the repository. - * The generated tree object is owned by the revision - * repo and shall not be freed by the user. - * - * @param tree pointer to the looked up tree - * @param repo the repo to use when locating the tree. - * @param id identity of the tree to locate. - * @return 0 on success; error code otherwise - */ -GIT_INLINE(int) git_tree_lookup(git_tree **tree, git_repository *repo, const git_oid *id) -{ - return git_object_lookup((git_object **)tree, repo, id, GIT_OBJ_TREE); -} - -/** - * Create a new in-memory git_tree. - * - * The tree object must be manually filled using - * setter methods before it can be written to its - * repository. - * - * @param tree pointer to the new tree - * @param repo The repository where the object will reside - * @return 0 on success; error code otherwise - */ -GIT_INLINE(int) git_tree_new(git_tree **tree, git_repository *repo) -{ - return git_object_new((git_object **)tree, repo, GIT_OBJ_TREE); -} - -/** - * Get the id of a tree. - * @param tree a previously loaded tree. - * @return object identity for the tree. - */ -GIT_EXTERN(const git_oid *) git_tree_id(git_tree *tree); - - -/** - * Get the number of entries listed in a tree - * @param tree a previously loaded tree. - * @return the number of entries in the tree - */ -GIT_EXTERN(size_t) git_tree_entrycount(git_tree *tree); - -/** - * Lookup a tree entry by its filename - * @param tree a previously loaded tree. - * @param filename the filename of the desired entry - * @return the tree entry; NULL if not found - */ -GIT_EXTERN(git_tree_entry *) git_tree_entry_byname(git_tree *tree, const char *filename); - -/** - * Lookup a tree entry by its position in the tree - * @param tree a previously loaded tree. - * @param idx the position in the entry list - * @return the tree entry; NULL if not found - */ -GIT_EXTERN(git_tree_entry *) git_tree_entry_byindex(git_tree *tree, int idx); - -/** - * Get the UNIX file attributes of a tree entry - * @param entry a tree entry - * @return attributes as an integer - */ -GIT_EXTERN(unsigned int) git_tree_entry_attributes(git_tree_entry *entry); - -/** - * Get the filename of a tree entry - * @param entry a tree entry - * @return the name of the file - */ -GIT_EXTERN(const char *) git_tree_entry_name(git_tree_entry *entry); - -/** - * Get the id of the object pointed by the entry - * @param entry a tree entry - * @return the oid of the object - */ -GIT_EXTERN(const git_oid *) git_tree_entry_id(git_tree_entry *entry); - -/** - * Convert a tree entry to the git_object it points too. - * - * @param object pointer to the converted object - * @param entry a tree entry - * @return a reference to the pointed object in the repository - */ -GIT_EXTERN(int) git_tree_entry_2object(git_object **object, git_tree_entry *entry); - -/** - * Add a new entry to a tree and return the new entry. - * - * This will mark the tree as modified; the new entry will - * be written back to disk on the next git_object_write() - * - * @param entry_out Pointer to the entry that just got - * created. May be NULL if you are not interested on - * getting the new entry - * @param tree Tree object to store the entry - * @iparam id OID for the tree entry - * @param filename Filename for the tree entry - * @param attributes UNIX file attributes for the entry - * @return 0 on success; otherwise error code - */ -GIT_EXTERN(int) git_tree_add_entry(git_tree_entry **entry_out, git_tree *tree, const git_oid *id, const char *filename, int attributes); - -/** - * Remove an entry by its index. - * - * Index must be >= 0 and < than git_tree_entrycount(). - * - * This will mark the tree as modified; the modified entry will - * be written back to disk on the next git_object_write() - * - * @param tree Tree where to remove the entry - * @param idx index of the entry - * @return 0 on successful removal; GIT_ENOTFOUND if the entry wasn't found - */ -GIT_EXTERN(int) git_tree_remove_entry_byindex(git_tree *tree, int idx); - -/** - * Remove an entry by its filename. - * - * This will mark the tree as modified; the modified entry will - * be written back to disk on the next git_object_write() - * - * @param tree Tree where to remove the entry - * @param filename File name of the entry - * @return 0 on successful removal; GIT_ENOTFOUND if the entry wasn't found - */ -GIT_EXTERN(int) git_tree_remove_entry_byname(git_tree *tree, const char *filename); - -/** - * Clear all the entries in a tree. - * - * This will mark the tree as modified; the modified entry will - * be written back to disk on the next git_object_write(). - * - * @param tree Tree object whose entries are to be sorted - */ -GIT_EXTERN(void) git_tree_clear_entries(git_tree *tree); - -/** - * Change the SHA1 id of a tree entry. - * - * This will mark the tree that contains the entry as modified; - * the modified entry will be written back to disk on the next git_object_write() - * - * @param entry Entry object which will be modified - * @param oid new SHA1 oid for the entry - */ -GIT_EXTERN(void) git_tree_entry_set_id(git_tree_entry *entry, const git_oid *oid); - -/** - * Change the filename of a tree entry. - * - * This will mark the tree that contains the entry as modified; - * the modified entry will be written back to disk on the next git_object_write() - * - * @param entry Entry object which will be modified - * @param oid new filename for the entry - */ -GIT_EXTERN(void) git_tree_entry_set_name(git_tree_entry *entry, const char *name); - -/** - * Change the attributes of a tree entry. - * - * This will mark the tree that contains the entry as modified; - * the modified entry will be written back to disk on the next git_object_write() - * - * @param entry Entry object which will be modified - * @param oid new attributes for the entry - */ -GIT_EXTERN(void) git_tree_entry_set_attributes(git_tree_entry *entry, int attr); - -/** @} */ -GIT_END_DECL -#endif diff --git a/src/git2/types.h b/src/git2/types.h deleted file mode 100644 index 62467ec4..00000000 --- a/src/git2/types.h +++ /dev/null @@ -1,153 +0,0 @@ -/* - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, - * as published by the Free Software Foundation. - * - * In addition to the permissions in the GNU General Public License, - * the authors give you unlimited permission to link the compiled - * version of this file into combinations with other programs, - * and to distribute those combinations without any restriction - * coming from the use of this file. (The General Public License - * restrictions do apply in other respects; for example, they cover - * modification of the file, and distribution when not linked into - * a combined executable.) - * - * This file is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDE_git_types_h__ -#define INCLUDE_git_types_h__ - -/** - * @file git2/types.h - * @brief libgit2 base & compatibility types - * @ingroup Git - * @{ - */ -GIT_BEGIN_DECL - -/** - * Cross-platform compatibility types for off_t / time_t - * - * NOTE: This needs to be in a public header so that both the library - * implementation and client applications both agree on the same types. - * Otherwise we get undefined behavior. - * - * Use the "best" types that each platform provides. Currently we truncate - * these intermediate representations for compatibility with the git ABI, but - * if and when it changes to support 64 bit types, our code will naturally - * adapt. - * NOTE: These types should match those that are returned by our internal - * stat() functions, for all platforms. - */ -#include <sys/types.h> - -#if defined(_MSC_VER) - -typedef __int64 git_off_t; -typedef __time64_t git_time_t; - -#elif defined(__MINGW32__) - -typedef off64_t git_off_t; -typedef time_t git_time_t; - -#else /* POSIX */ - -/* - * Note: Can't use off_t since if a client program includes <sys/types.h> - * before us (directly or indirectly), they'll get 32 bit off_t in their client - * app, even though /we/ define _FILE_OFFSET_BITS=64. - */ -typedef long long git_off_t; -typedef time_t git_time_t; - -#endif - - -/** Basic type (loose or packed) of any Git object. */ -typedef enum { - GIT_OBJ_ANY = -2, /**< Object can be any of the following */ - GIT_OBJ_BAD = -1, /**< Object is invalid. */ - GIT_OBJ__EXT1 = 0, /**< Reserved for future use. */ - GIT_OBJ_COMMIT = 1, /**< A commit object. */ - GIT_OBJ_TREE = 2, /**< A tree (directory listing) object. */ - GIT_OBJ_BLOB = 3, /**< A file revision object. */ - GIT_OBJ_TAG = 4, /**< An annotated tag object. */ - GIT_OBJ__EXT2 = 5, /**< Reserved for future use. */ - GIT_OBJ_OFS_DELTA = 6, /**< A delta, base is given by an offset. */ - GIT_OBJ_REF_DELTA = 7, /**< A delta, base is given by object id. */ -} git_otype; - -/** An open object database handle. */ -typedef struct git_odb git_odb; - -/** A custom backend in an ODB */ -typedef struct git_odb_backend git_odb_backend; - -/** - * Representation of an existing git repository, - * including all its object contents - */ -typedef struct git_repository git_repository; - -/** Representation of a generic object in a repository */ -typedef struct git_object git_object; - -/** Representation of an in-progress walk through the commits in a repo */ -typedef struct git_revwalk git_revwalk; - -/** Parsed representation of a tag object. */ -typedef struct git_tag git_tag; - -/** In-memory representation of a blob object. */ -typedef struct git_blob git_blob; - -/** Parsed representation of a commit object. */ -typedef struct git_commit git_commit; - -/** Representation of each one of the entries in a tree object. */ -typedef struct git_tree_entry git_tree_entry; - -/** Representation of a tree object. */ -typedef struct git_tree git_tree; - -/** Memory representation of an index file. */ -typedef struct git_index git_index; - -/** Time in a signature */ -typedef struct git_time { - time_t time; /** time in seconds from epoch */ - int offset; /** timezone offset, in minutes */ -} git_time; - -/** An action signature (e.g. for committers, taggers, etc) */ -typedef struct git_signature { - char *name; /** full name of the author */ - char *email; /** email of the author */ - git_time when; /** time when the action happened */ -} git_signature; - -/** In-memory representation of a reference. */ -typedef struct git_reference git_reference; - -/** Basic type of any Git reference. */ -typedef enum { - GIT_REF_INVALID = 0, /** Invalid reference */ - GIT_REF_OID = 1, /** A reference which points at an object id */ - GIT_REF_SYMBOLIC = 2, /** A reference which points at another reference */ - GIT_REF_PACKED = 4, - GIT_REF_HAS_PEEL = 8, -} git_rtype; - -/** @} */ -GIT_END_DECL - -#endif diff --git a/src/git2/zlib.h b/src/git2/zlib.h deleted file mode 100644 index 49356634..00000000 --- a/src/git2/zlib.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, - * as published by the Free Software Foundation. - * - * In addition to the permissions in the GNU General Public License, - * the authors give you unlimited permission to link the compiled - * version of this file into combinations with other programs, - * and to distribute those combinations without any restriction - * coming from the use of this file. (The General Public License - * restrictions do apply in other respects; for example, they cover - * modification of the file, and distribution when not linked into - * a combined executable.) - * - * This file is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDE_git_zlib_h__ -#define INCLUDE_git_zlib_h__ - -#include <zlib.h> - -/** - * @file git2/zlib.h - * @brief Git data compression routines - * @defgroup git_zlib Git data compression routines - * @ingroup Git - * @{ - */ -GIT_BEGIN_DECL - -#if defined(NO_DEFLATE_BOUND) || ZLIB_VERNUM < 0x1200 -/** - * deflateBound returns an upper bound on the compressed size. - * - * This is a stub function used when zlib does not supply the - * deflateBound() implementation itself. - * - * @param stream the stream pointer. - * @param s total length of the source data (in bytes). - * @return maximum length of the compressed data. - */ -GIT_INLINE(size_t) deflateBound(z_streamp stream, size_t s) -{ - return (s + ((s + 7) >> 3) + ((s + 63) >> 6) + 11); -} -#endif - -/** @} */ -GIT_END_DECL -#endif |