summaryrefslogtreecommitdiff
path: root/include/git2
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@elego.de>2011-05-05 16:22:06 +0200
committerCarlos Martín Nieto <cmn@elego.de>2011-05-05 16:22:06 +0200
commitca8d2dfc0cea0c16e2d6bae16d95d652e292f473 (patch)
treef98e0c362a388f9a9efe644ac3e38828f5f14807 /include/git2
parent094aaaaee92f4fc98a6c3c3af36183cb217948a8 (diff)
parentcc3b82e376e0216c1af4ad46d24327d61e9efd99 (diff)
downloadlibgit2-ca8d2dfc0cea0c16e2d6bae16d95d652e292f473.tar.gz
Merge remote-tracking branch 'upstream/development' into config
Diffstat (limited to 'include/git2')
-rw-r--r--include/git2/index.h95
-rw-r--r--include/git2/tag.h17
2 files changed, 80 insertions, 32 deletions
diff --git a/include/git2/index.h b/include/git2/index.h
index 8a84f507..7991de92 100644
--- a/include/git2/index.h
+++ b/include/git2/index.h
@@ -51,39 +51,29 @@ GIT_BEGIN_DECL
*
* In-memory only flags:
*/
-#define GIT_IDXENTRY_UPDATE (1 << 16)
-#define GIT_IDXENTRY_REMOVE (1 << 17)
-#define GIT_IDXENTRY_UPTODATE (1 << 18)
-#define GIT_IDXENTRY_ADDED (1 << 19)
+#define GIT_IDXENTRY_UPDATE (1 << 0)
+#define GIT_IDXENTRY_REMOVE (1 << 1)
+#define GIT_IDXENTRY_UPTODATE (1 << 2)
+#define GIT_IDXENTRY_ADDED (1 << 3)
-#define GIT_IDXENTRY_HASHED (1 << 20)
-#define GIT_IDXENTRY_UNHASHED (1 << 21)
-#define GIT_IDXENTRY_WT_REMOVE (1 << 22) /* remove in work directory */
-#define GIT_IDXENTRY_CONFLICTED (1 << 23)
+#define GIT_IDXENTRY_HASHED (1 << 4)
+#define GIT_IDXENTRY_UNHASHED (1 << 5)
+#define GIT_IDXENTRY_WT_REMOVE (1 << 6) /* remove in work directory */
+#define GIT_IDXENTRY_CONFLICTED (1 << 7)
-#define GIT_IDXENTRY_UNPACKED (1 << 24)
-#define GIT_IDXENTRY_NEW_SKIP_WORKTREE (1 << 25)
+#define GIT_IDXENTRY_UNPACKED (1 << 8)
+#define GIT_IDXENTRY_NEW_SKIP_WORKTREE (1 << 9)
/*
* Extended on-disk flags:
*/
-#define GIT_IDXENTRY_INTENT_TO_ADD (1 << 29)
-#define GIT_IDXENTRY_SKIP_WORKTREE (1 << 30)
+#define GIT_IDXENTRY_INTENT_TO_ADD (1 << 13)
+#define GIT_IDXENTRY_SKIP_WORKTREE (1 << 14)
/* GIT_IDXENTRY_EXTENDED2 is for future extension */
-#define GIT_IDXENTRY_EXTENDED2 (1 << 31)
+#define GIT_IDXENTRY_EXTENDED2 (1 << 15)
#define GIT_IDXENTRY_EXTENDED_FLAGS (GIT_IDXENTRY_INTENT_TO_ADD | GIT_IDXENTRY_SKIP_WORKTREE)
-/*
- * Safeguard to avoid saving wrong flags:
- * - GIT_IDXENTRY_EXTENDED2 won't get saved until its semantic is known
- * - Bits in 0x0000FFFF have been saved in flags already
- * - Bits in 0x003F0000 are currently in-memory flags
- */
-#if GIT_IDXENTRY_EXTENDED_FLAGS & 0x803FFFFF
-#error "GIT_IDXENTRY_EXTENDED_FLAGS out of range"
-#endif
-
/** Time used in a git index entry */
typedef struct {
git_time_t seconds;
@@ -182,7 +172,12 @@ GIT_EXTERN(int) git_index_write(git_index *index);
GIT_EXTERN(int) git_index_find(git_index *index, const char *path);
/**
- * Add or update an index entry from a file in disk.
+ * Add or update an index entry from a file in disk
+ *
+ * The file `path` must be relative to the repository's
+ * working folder and must be readable.
+ *
+ * This method will fail in bare index instances.
*
* @param index an existing index object
* @param path filename to add
@@ -192,26 +187,62 @@ GIT_EXTERN(int) git_index_find(git_index *index, const char *path);
GIT_EXTERN(int) git_index_add(git_index *index, const char *path, int stage);
/**
- * Remove an entry from the index
+ * Add or update an index entry from an in-memory struct
+ *
+ * A full copy (including the 'path' string) of the given
+ * 'source_entry' will be inserted on the index.
*
* @param index an existing index object
- * @param position position of the entry to remove
+ * @param source_entry new entry object
* @return 0 on success, otherwise an error code
*/
-GIT_EXTERN(int) git_index_remove(git_index *index, int position);
+GIT_EXTERN(int) git_index_add2(git_index *index, const git_index_entry *source_entry);
/**
- * Insert an entry into the index.
+ * Add (append) an index entry from a file in disk
+ *
+ * A new entry will always be inserted into the index;
+ * if the index already contains an entry for such
+ * path, the old entry will **not** be replaced.
+ *
+ * The file `path` must be relative to the repository's
+ * working folder and must be readable.
+ *
+ * This method will fail in bare index instances.
+ *
+ * @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_append(git_index *index, const char *path, int stage);
+
+/**
+ * Add (append) an index entry from an in-memory struct
+ *
+ * A new entry will always be inserted into the index;
+ * if the index already contains an entry for the path
+ * in the `entry` struct, the old entry will **not** be
+ * replaced.
+ *
* 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.
+ * 'source_entry' will be inserted on the index.
*
* @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);
+GIT_EXTERN(int) git_index_apppend2(git_index *index, const git_index_entry *source_entry);
+
+/**
+ * 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);
+
/**
* Get a pointer to one of the entries in the index
diff --git a/include/git2/tag.h b/include/git2/tag.h
index c751a13c..3fc6b449 100644
--- a/include/git2/tag.h
+++ b/include/git2/tag.h
@@ -275,6 +275,23 @@ GIT_EXTERN(int) git_tag_delete(
git_repository *repo,
const char *tag_name);
+/**
+ * Fill a list with all the tags in the Repository
+ *
+ * The string array will be filled with the names of the
+ * matching tags; these values are owned by the user and
+ * should be free'd manually when no longer needed, using
+ * `git_strarray_free`.
+ *
+ * @param array Pointer to a git_strarray structure where
+ * the tag names will be stored
+ * @param repo Repository where to find the tags
+ * @return 0 on success; error code otherwise
+ */
+GIT_EXTERN(int) git_tag_list(
+ git_strarray *tag_names,
+ git_repository *repo);
+
/** @} */
GIT_END_DECL
#endif