summaryrefslogtreecommitdiff
path: root/include/git2
diff options
context:
space:
mode:
Diffstat (limited to 'include/git2')
-rw-r--r--include/git2/blob.h12
-rw-r--r--include/git2/common.h8
-rw-r--r--include/git2/oid.h6
-rw-r--r--include/git2/refspec.h8
-rw-r--r--include/git2/status.h4
-rw-r--r--include/git2/tree.h4
6 files changed, 29 insertions, 13 deletions
diff --git a/include/git2/blob.h b/include/git2/blob.h
index 44b29d7eb..afa350bb1 100644
--- a/include/git2/blob.h
+++ b/include/git2/blob.h
@@ -103,6 +103,18 @@ GIT_EXTERN(size_t) git_blob_rawsize(git_blob *blob);
*/
GIT_EXTERN(int) git_blob_create_fromfile(git_oid *oid, git_repository *repo, const char *path);
+/**
+ * Read a file from the filesystem and write its content
+ * to the Object Database as a loose blob
+ *
+ * @param oid return the id of the written blob
+ * @param repo repository where the blob will be written.
+ * this repository can be bare or not
+ * @param path file from which the blob will be created
+ * @return GIT_SUCCESS or an error code
+ */
+GIT_EXTERN(int) git_blob_create_fromdisk(git_oid *oid, git_repository *repo, const char *path);
+
/**
* Write an in-memory buffer to the ODB as a blob
diff --git a/include/git2/common.h b/include/git2/common.h
index a8f8d8e1e..a16cf43d5 100644
--- a/include/git2/common.h
+++ b/include/git2/common.h
@@ -32,7 +32,11 @@
__attribute__((visibility("default"))) \
type
#elif defined(_MSC_VER)
-# define GIT_EXTERN(type) __declspec(dllexport) type
+# ifdef git2_EXPORTS /* defined by cmake */
+# define GIT_EXTERN(type) __declspec(dllexport) type
+# else
+# define GIT_EXTERN(type) __declspec(dllimport) type
+# endif
#else
# define GIT_EXTERN(type) extern type
#endif
@@ -77,7 +81,7 @@ GIT_BEGIN_DECL
#endif
/**
- * The maximum length of a git valid git path.
+ * The maximum length of a valid git path.
*/
#define GIT_PATH_MAX 4096
diff --git a/include/git2/oid.h b/include/git2/oid.h
index 566d13ac1..87efbab2f 100644
--- a/include/git2/oid.h
+++ b/include/git2/oid.h
@@ -183,7 +183,7 @@ typedef struct git_oid_shorten git_oid_shorten;
* be unique.
* @return a `git_oid_shorten` instance, NULL if OOM
*/
-git_oid_shorten *git_oid_shorten_new(size_t min_length);
+GIT_EXTERN(git_oid_shorten *) git_oid_shorten_new(size_t min_length);
/**
* Add a new OID to set of shortened OIDs and calculate
@@ -209,14 +209,14 @@ git_oid_shorten *git_oid_shorten_new(size_t min_length);
* added so far to the set; or an error code (<0) if an
* error occurs.
*/
-int git_oid_shorten_add(git_oid_shorten *os, const char *text_oid);
+GIT_EXTERN(int) git_oid_shorten_add(git_oid_shorten *os, const char *text_oid);
/**
* Free an OID shortener instance
*
* @param os a `git_oid_shorten` instance
*/
-void git_oid_shorten_free(git_oid_shorten *os);
+GIT_EXTERN(void) git_oid_shorten_free(git_oid_shorten *os);
/** @} */
GIT_END_DECL
diff --git a/include/git2/refspec.h b/include/git2/refspec.h
index 28afe652d..50aa596f9 100644
--- a/include/git2/refspec.h
+++ b/include/git2/refspec.h
@@ -25,7 +25,7 @@ GIT_BEGIN_DECL
* @param refspec the refspec
* @return the refspec's source specifier
*/
-const char *git_refspec_src(const git_refspec *refspec);
+GIT_EXTERN(const char *) git_refspec_src(const git_refspec *refspec);
/**
* Get the destination specifier
@@ -33,7 +33,7 @@ const char *git_refspec_src(const git_refspec *refspec);
* @param refspec the refspec
* @return the refspec's destination specifier
*/
-const char *git_refspec_dst(const git_refspec *refspec);
+GIT_EXTERN(const char *) git_refspec_dst(const git_refspec *refspec);
/**
* Check if a refspec's source descriptor matches a reference
@@ -42,7 +42,7 @@ const char *git_refspec_dst(const git_refspec *refspec);
* @param refname the name of the reference to check
* @return 1 if the refspec matches, 0 otherwise
*/
-int git_refspec_src_matches(const git_refspec *refspec, const char *refname);
+GIT_EXTERN(int) git_refspec_src_matches(const git_refspec *refspec, const char *refname);
/**
* Transform a reference to its target following the refspec's rules
@@ -53,7 +53,7 @@ int git_refspec_src_matches(const git_refspec *refspec, const char *refname);
* @param name the name of the reference to transform
* @return GIT_SUCCESS, GIT_ESHORTBUFFER or another error
*/
-int git_refspec_transform(char *out, size_t outlen, const git_refspec *spec, const char *name);
+GIT_EXTERN(int) git_refspec_transform(char *out, size_t outlen, const git_refspec *spec, const char *name);
GIT_END_DECL
diff --git a/include/git2/status.h b/include/git2/status.h
index f5fc95f0a..0aff56a65 100644
--- a/include/git2/status.h
+++ b/include/git2/status.h
@@ -139,13 +139,13 @@ GIT_EXTERN(int) git_status_file(unsigned int *status_flags, git_repository *repo
* would be ignored regardless of whether the file is already in the index
* or in the repository.
*
+ * @param ignored boolean returning 0 if the file is not ignored, 1 if it is
* @param repo a repository object
* @param path the file to check ignores for, rooted at the repo's workdir
- * @param ignored boolean returning 0 if the file is not ignored, 1 if it is
* @return GIT_SUCCESS if the ignore rules could be processed for the file
* (regardless of whether it exists or not), or an error < 0 if they could not.
*/
-GIT_EXTERN(int) git_status_should_ignore(git_repository *repo, const char *path, int *ignored);
+GIT_EXTERN(int) git_status_should_ignore(int *ignored, git_repository *repo, const char *path);
/** @} */
GIT_END_DECL
diff --git a/include/git2/tree.h b/include/git2/tree.h
index 972c3795c..f75cc1cbb 100644
--- a/include/git2/tree.h
+++ b/include/git2/tree.h
@@ -343,9 +343,9 @@ typedef int (*git_tree_diff_cb)(const git_tree_diff_data *ptr, void *data);
* @param data data to give to the callback
* @return GIT_SUCCESS or an error code
*/
-int git_tree_diff(git_tree *old, git_tree *newer, git_tree_diff_cb cb, void *data);
+GIT_EXTERN(int) git_tree_diff(git_tree *old, git_tree *newer, git_tree_diff_cb cb, void *data);
-int git_tree_diff_index_recursive(git_tree *tree, git_index *index, git_tree_diff_cb cb, void *data);
+GIT_EXTERN(int) git_tree_diff_index_recursive(git_tree *tree, git_index *index, git_tree_diff_cb cb, void *data);
/** @} */