docurium 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +3 -0
- data/Gemfile +5 -0
- data/LICENCE +19 -0
- data/README.md +39 -0
- data/TODO.txt +19 -0
- data/bin/cm +31 -0
- data/docurium.gemspec +25 -0
- data/lib/docurium.rb +435 -0
- data/lib/docurium/cli.rb +10 -0
- data/site/css/style.css +236 -0
- data/site/images/search_icon.png +0 -0
- data/site/index.html +65 -0
- data/site/js/backbone.js +27 -0
- data/site/js/docurium.js +649 -0
- data/site/js/json2.js +26 -0
- data/site/js/underscore.js +26 -0
- data/site/shared/css/documentation.css +797 -0
- data/site/shared/css/pygments.css +60 -0
- data/site/shared/images/active-arrow.png +0 -0
- data/site/shared/images/background-v2.png +0 -0
- data/site/shared/images/background-white.png +0 -0
- data/site/shared/images/dropdown_sprites.jpg +0 -0
- data/site/shared/images/footer_logo.png +0 -0
- data/site/shared/images/logo.png +0 -0
- data/site/shared/images/nav-rule.png +0 -0
- data/site/shared/images/next_step_arrow.gif +0 -0
- data/site/shared/images/qmark.png +0 -0
- data/site/shared/js/documentation.js +43 -0
- data/site/shared/js/jquery.js +154 -0
- data/test/fixtures/git2/api.docurium +6 -0
- data/test/fixtures/git2/blob.h +121 -0
- data/test/fixtures/git2/commit.h +302 -0
- data/test/fixtures/git2/common.h +98 -0
- data/test/fixtures/git2/errors.h +149 -0
- data/test/fixtures/git2/index.h +270 -0
- data/test/fixtures/git2/object.h +147 -0
- data/test/fixtures/git2/odb.h +302 -0
- data/test/fixtures/git2/odb_backend.h +107 -0
- data/test/fixtures/git2/oid.h +191 -0
- data/test/fixtures/git2/refs.h +325 -0
- data/test/fixtures/git2/repository.h +217 -0
- data/test/fixtures/git2/revwalk.h +187 -0
- data/test/fixtures/git2/signature.h +81 -0
- data/test/fixtures/git2/tag.h +297 -0
- data/test/fixtures/git2/thread-utils.h +71 -0
- data/test/fixtures/git2/tree.h +266 -0
- data/test/fixtures/git2/types.h +162 -0
- data/test/fixtures/git2/zlib.h +58 -0
- data/test/repo_test.rb +101 -0
- data/test/test_helper.rb +29 -0
- metadata +167 -0
@@ -0,0 +1,98 @@
|
|
1
|
+
/*
|
2
|
+
* This file is free software; you can redistribute it and/or modify
|
3
|
+
* it under the terms of the GNU General Public License, version 2,
|
4
|
+
* as published by the Free Software Foundation.
|
5
|
+
*
|
6
|
+
* In addition to the permissions in the GNU General Public License,
|
7
|
+
* the authors give you unlimited permission to link the compiled
|
8
|
+
* version of this file into combinations with other programs,
|
9
|
+
* and to distribute those combinations without any restriction
|
10
|
+
* coming from the use of this file. (The General Public License
|
11
|
+
* restrictions do apply in other respects; for example, they cover
|
12
|
+
* modification of the file, and distribution when not linked into
|
13
|
+
* a combined executable.)
|
14
|
+
*
|
15
|
+
* This file is distributed in the hope that it will be useful, but
|
16
|
+
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
17
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
18
|
+
* General Public License for more details.
|
19
|
+
*
|
20
|
+
* You should have received a copy of the GNU General Public License
|
21
|
+
* along with this program; see the file COPYING. If not, write to
|
22
|
+
* the Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
23
|
+
* Boston, MA 02110-1301, USA.
|
24
|
+
*/
|
25
|
+
#ifndef INCLUDE_git_common_h__
|
26
|
+
#define INCLUDE_git_common_h__
|
27
|
+
|
28
|
+
#include "thread-utils.h"
|
29
|
+
#include <time.h>
|
30
|
+
#include <stdlib.h>
|
31
|
+
|
32
|
+
#ifdef __cplusplus
|
33
|
+
# define GIT_BEGIN_DECL extern "C" {
|
34
|
+
# define GIT_END_DECL }
|
35
|
+
#else
|
36
|
+
/** Start declarations in C mode */
|
37
|
+
# define GIT_BEGIN_DECL /* empty */
|
38
|
+
/** End declarations in C mode */
|
39
|
+
# define GIT_END_DECL /* empty */
|
40
|
+
#endif
|
41
|
+
|
42
|
+
/** Declare a public function exported for application use. */
|
43
|
+
#ifdef __GNUC__
|
44
|
+
# define GIT_EXTERN(type) extern \
|
45
|
+
__attribute__((visibility("default"))) \
|
46
|
+
type
|
47
|
+
#elif defined(_MSC_VER)
|
48
|
+
# define GIT_EXTERN(type) __declspec(dllexport) type
|
49
|
+
#else
|
50
|
+
# define GIT_EXTERN(type) extern type
|
51
|
+
#endif
|
52
|
+
|
53
|
+
/** Declare a public TLS symbol exported for application use. */
|
54
|
+
#ifdef __GNUC__
|
55
|
+
# define GIT_EXTERN_TLS(type) extern \
|
56
|
+
__attribute__((visibility("default"))) \
|
57
|
+
GIT_TLS \
|
58
|
+
type
|
59
|
+
#elif defined(_MSC_VER)
|
60
|
+
# define GIT_EXTERN_TLS(type) __declspec(dllexport) GIT_TLS type
|
61
|
+
#else
|
62
|
+
# define GIT_EXTERN_TLS(type) extern GIT_TLS type
|
63
|
+
#endif
|
64
|
+
|
65
|
+
/** Declare a function as always inlined. */
|
66
|
+
#if defined(_MSC_VER)
|
67
|
+
# define GIT_INLINE(type) static __inline type
|
68
|
+
#else
|
69
|
+
# define GIT_INLINE(type) static inline type
|
70
|
+
#endif
|
71
|
+
|
72
|
+
/** Declare a function's takes printf style arguments. */
|
73
|
+
#ifdef __GNUC__
|
74
|
+
# define GIT_FORMAT_PRINTF(a,b) __attribute__((format (printf, a, b)))
|
75
|
+
#else
|
76
|
+
# define GIT_FORMAT_PRINTF(a,b) /* empty */
|
77
|
+
#endif
|
78
|
+
|
79
|
+
/**
|
80
|
+
* @file git2/common.h
|
81
|
+
* @brief Git common platform definitions
|
82
|
+
* @defgroup git_common Git common platform definitions
|
83
|
+
* @ingroup Git
|
84
|
+
* @{
|
85
|
+
*/
|
86
|
+
|
87
|
+
GIT_BEGIN_DECL
|
88
|
+
|
89
|
+
typedef struct {
|
90
|
+
char **strings;
|
91
|
+
size_t count;
|
92
|
+
} git_strarray;
|
93
|
+
|
94
|
+
GIT_EXTERN(void) git_strarray_free(git_strarray *array);
|
95
|
+
|
96
|
+
/** @} */
|
97
|
+
GIT_END_DECL
|
98
|
+
#endif
|
@@ -0,0 +1,149 @@
|
|
1
|
+
/*
|
2
|
+
* This file is free software; you can redistribute it and/or modify
|
3
|
+
* it under the terms of the GNU General Public License, version 2,
|
4
|
+
* as published by the Free Software Foundation.
|
5
|
+
*
|
6
|
+
* In addition to the permissions in the GNU General Public License,
|
7
|
+
* the authors give you unlimited permission to link the compiled
|
8
|
+
* version of this file into combinations with other programs,
|
9
|
+
* and to distribute those combinations without any restriction
|
10
|
+
* coming from the use of this file. (The General Public License
|
11
|
+
* restrictions do apply in other respects; for example, they cover
|
12
|
+
* modification of the file, and distribution when not linked into
|
13
|
+
* a combined executable.)
|
14
|
+
*
|
15
|
+
* This file is distributed in the hope that it will be useful, but
|
16
|
+
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
17
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
18
|
+
* General Public License for more details.
|
19
|
+
*
|
20
|
+
* You should have received a copy of the GNU General Public License
|
21
|
+
* along with this program; see the file COPYING. If not, write to
|
22
|
+
* the Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
23
|
+
* Boston, MA 02110-1301, USA.
|
24
|
+
*/
|
25
|
+
#ifndef INCLUDE_git_errors_h__
|
26
|
+
#define INCLUDE_git_errors_h__
|
27
|
+
|
28
|
+
/**
|
29
|
+
* @file git2/errors.h
|
30
|
+
* @brief Git error handling routines and variables
|
31
|
+
* @ingroup Git
|
32
|
+
* @{
|
33
|
+
*/
|
34
|
+
GIT_BEGIN_DECL
|
35
|
+
|
36
|
+
/** Operation completed successfully. */
|
37
|
+
#define GIT_SUCCESS 0
|
38
|
+
|
39
|
+
/**
|
40
|
+
* Operation failed, with unspecified reason.
|
41
|
+
* This value also serves as the base error code; all other
|
42
|
+
* error codes are subtracted from it such that all errors
|
43
|
+
* are < 0, in typical POSIX C tradition.
|
44
|
+
*/
|
45
|
+
#define GIT_ERROR -1
|
46
|
+
|
47
|
+
/** Input was not a properly formatted Git object id. */
|
48
|
+
#define GIT_ENOTOID (GIT_ERROR - 1)
|
49
|
+
|
50
|
+
/** Input does not exist in the scope searched. */
|
51
|
+
#define GIT_ENOTFOUND (GIT_ERROR - 2)
|
52
|
+
|
53
|
+
/** Not enough space available. */
|
54
|
+
#define GIT_ENOMEM (GIT_ERROR - 3)
|
55
|
+
|
56
|
+
/** Consult the OS error information. */
|
57
|
+
#define GIT_EOSERR (GIT_ERROR - 4)
|
58
|
+
|
59
|
+
/** The specified object is of invalid type */
|
60
|
+
#define GIT_EOBJTYPE (GIT_ERROR - 5)
|
61
|
+
|
62
|
+
/** The specified object has its data corrupted */
|
63
|
+
#define GIT_EOBJCORRUPTED (GIT_ERROR - 6)
|
64
|
+
|
65
|
+
/** The specified repository is invalid */
|
66
|
+
#define GIT_ENOTAREPO (GIT_ERROR - 7)
|
67
|
+
|
68
|
+
/** The object type is invalid or doesn't match */
|
69
|
+
#define GIT_EINVALIDTYPE (GIT_ERROR - 8)
|
70
|
+
|
71
|
+
/** The object cannot be written because it's missing internal data */
|
72
|
+
#define GIT_EMISSINGOBJDATA (GIT_ERROR - 9)
|
73
|
+
|
74
|
+
/** The packfile for the ODB is corrupted */
|
75
|
+
#define GIT_EPACKCORRUPTED (GIT_ERROR - 10)
|
76
|
+
|
77
|
+
/** Failed to acquire or release a file lock */
|
78
|
+
#define GIT_EFLOCKFAIL (GIT_ERROR - 11)
|
79
|
+
|
80
|
+
/** The Z library failed to inflate/deflate an object's data */
|
81
|
+
#define GIT_EZLIB (GIT_ERROR - 12)
|
82
|
+
|
83
|
+
/** The queried object is currently busy */
|
84
|
+
#define GIT_EBUSY (GIT_ERROR - 13)
|
85
|
+
|
86
|
+
/** The index file is not backed up by an existing repository */
|
87
|
+
#define GIT_EBAREINDEX (GIT_ERROR - 14)
|
88
|
+
|
89
|
+
/** The name of the reference is not valid */
|
90
|
+
#define GIT_EINVALIDREFNAME (GIT_ERROR - 15)
|
91
|
+
|
92
|
+
/** The specified reference has its data corrupted */
|
93
|
+
#define GIT_EREFCORRUPTED (GIT_ERROR - 16)
|
94
|
+
|
95
|
+
/** The specified symbolic reference is too deeply nested */
|
96
|
+
#define GIT_ETOONESTEDSYMREF (GIT_ERROR - 17)
|
97
|
+
|
98
|
+
/** The pack-refs file is either corrupted or its format is not currently supported */
|
99
|
+
#define GIT_EPACKEDREFSCORRUPTED (GIT_ERROR - 18)
|
100
|
+
|
101
|
+
/** The path is invalid */
|
102
|
+
#define GIT_EINVALIDPATH (GIT_ERROR - 19)
|
103
|
+
|
104
|
+
/** The revision walker is empty; there are no more commits left to iterate */
|
105
|
+
#define GIT_EREVWALKOVER (GIT_ERROR - 20)
|
106
|
+
|
107
|
+
/** The state of the reference is not valid */
|
108
|
+
#define GIT_EINVALIDREFSTATE (GIT_ERROR - 21)
|
109
|
+
|
110
|
+
/** This feature has not been implemented yet */
|
111
|
+
#define GIT_ENOTIMPLEMENTED (GIT_ERROR - 22)
|
112
|
+
|
113
|
+
/** A reference with this name already exists */
|
114
|
+
#define GIT_EEXISTS (GIT_ERROR - 23)
|
115
|
+
|
116
|
+
/** The given integer literal is too large to be parsed */
|
117
|
+
#define GIT_EOVERFLOW (GIT_ERROR - 24)
|
118
|
+
|
119
|
+
/** The given literal is not a valid number */
|
120
|
+
#define GIT_ENOTNUM (GIT_ERROR - 25)
|
121
|
+
|
122
|
+
/** Streaming error */
|
123
|
+
#define GIT_ESTREAM (GIT_ERROR - 26)
|
124
|
+
|
125
|
+
/** invalid arguments to function */
|
126
|
+
#define GIT_EINVALIDARGS (GIT_ERROR - 27)
|
127
|
+
|
128
|
+
/**
|
129
|
+
* Return a detailed error string with the latest error
|
130
|
+
* that occurred in the library.
|
131
|
+
* @return a string explaining the error
|
132
|
+
*/
|
133
|
+
GIT_EXTERN(const char *) git_lasterror(void);
|
134
|
+
|
135
|
+
/**
|
136
|
+
* strerror() for the Git library
|
137
|
+
*
|
138
|
+
* Get a string description for a given error code.
|
139
|
+
* NOTE: This method will be eventually deprecated in favor
|
140
|
+
* of the new `git_lasterror`.
|
141
|
+
*
|
142
|
+
* @param num The error code to explain
|
143
|
+
* @return a string explaining the error code
|
144
|
+
*/
|
145
|
+
GIT_EXTERN(const char *) git_strerror(int num);
|
146
|
+
|
147
|
+
/** @} */
|
148
|
+
GIT_END_DECL
|
149
|
+
#endif
|
@@ -0,0 +1,270 @@
|
|
1
|
+
/*
|
2
|
+
* This file is free software; you can redistribute it and/or modify
|
3
|
+
* it under the terms of the GNU General Public License, version 2,
|
4
|
+
* as published by the Free Software Foundation.
|
5
|
+
*
|
6
|
+
* In addition to the permissions in the GNU General Public License,
|
7
|
+
* the authors give you unlimited permission to link the compiled
|
8
|
+
* version of this file into combinations with other programs,
|
9
|
+
* and to distribute those combinations without any restriction
|
10
|
+
* coming from the use of this file. (The General Public License
|
11
|
+
* restrictions do apply in other respects; for example, they cover
|
12
|
+
* modification of the file, and distribution when not linked into
|
13
|
+
* a combined executable.)
|
14
|
+
*
|
15
|
+
* This file is distributed in the hope that it will be useful, but
|
16
|
+
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
17
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
18
|
+
* General Public License for more details.
|
19
|
+
*
|
20
|
+
* You should have received a copy of the GNU General Public License
|
21
|
+
* along with this program; see the file COPYING. If not, write to
|
22
|
+
* the Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
23
|
+
* Boston, MA 02110-1301, USA.
|
24
|
+
*/
|
25
|
+
#ifndef INCLUDE_git_index_h__
|
26
|
+
#define INCLUDE_git_index_h__
|
27
|
+
|
28
|
+
#include "common.h"
|
29
|
+
#include "types.h"
|
30
|
+
#include "oid.h"
|
31
|
+
|
32
|
+
/**
|
33
|
+
* @file git2/index.h
|
34
|
+
* @brief Git index parsing and manipulation routines
|
35
|
+
* @defgroup git_index Git index parsing and manipulation routines
|
36
|
+
* @ingroup Git
|
37
|
+
* @{
|
38
|
+
*/
|
39
|
+
GIT_BEGIN_DECL
|
40
|
+
|
41
|
+
#define GIT_IDXENTRY_NAMEMASK (0x0fff)
|
42
|
+
#define GIT_IDXENTRY_STAGEMASK (0x3000)
|
43
|
+
#define GIT_IDXENTRY_EXTENDED (0x4000)
|
44
|
+
#define GIT_IDXENTRY_VALID (0x8000)
|
45
|
+
#define GIT_IDXENTRY_STAGESHIFT 12
|
46
|
+
|
47
|
+
/*
|
48
|
+
* Flags are divided into two parts: in-memory flags and
|
49
|
+
* on-disk ones. Flags in GIT_IDXENTRY_EXTENDED_FLAGS
|
50
|
+
* will get saved on-disk.
|
51
|
+
*
|
52
|
+
* In-memory only flags:
|
53
|
+
*/
|
54
|
+
#define GIT_IDXENTRY_UPDATE (1 << 0)
|
55
|
+
#define GIT_IDXENTRY_REMOVE (1 << 1)
|
56
|
+
#define GIT_IDXENTRY_UPTODATE (1 << 2)
|
57
|
+
#define GIT_IDXENTRY_ADDED (1 << 3)
|
58
|
+
|
59
|
+
#define GIT_IDXENTRY_HASHED (1 << 4)
|
60
|
+
#define GIT_IDXENTRY_UNHASHED (1 << 5)
|
61
|
+
#define GIT_IDXENTRY_WT_REMOVE (1 << 6) /* remove in work directory */
|
62
|
+
#define GIT_IDXENTRY_CONFLICTED (1 << 7)
|
63
|
+
|
64
|
+
#define GIT_IDXENTRY_UNPACKED (1 << 8)
|
65
|
+
#define GIT_IDXENTRY_NEW_SKIP_WORKTREE (1 << 9)
|
66
|
+
|
67
|
+
/*
|
68
|
+
* Extended on-disk flags:
|
69
|
+
*/
|
70
|
+
#define GIT_IDXENTRY_INTENT_TO_ADD (1 << 13)
|
71
|
+
#define GIT_IDXENTRY_SKIP_WORKTREE (1 << 14)
|
72
|
+
/* GIT_IDXENTRY_EXTENDED2 is for future extension */
|
73
|
+
#define GIT_IDXENTRY_EXTENDED2 (1 << 15)
|
74
|
+
|
75
|
+
#define GIT_IDXENTRY_EXTENDED_FLAGS (GIT_IDXENTRY_INTENT_TO_ADD | GIT_IDXENTRY_SKIP_WORKTREE)
|
76
|
+
|
77
|
+
/** Time used in a git index entry */
|
78
|
+
typedef struct {
|
79
|
+
git_time_t seconds;
|
80
|
+
/* nsec should not be stored as time_t compatible */
|
81
|
+
unsigned int nanoseconds;
|
82
|
+
} git_index_time;
|
83
|
+
|
84
|
+
/** Memory representation of a file entry in the index. */
|
85
|
+
typedef struct git_index_entry {
|
86
|
+
git_index_time ctime;
|
87
|
+
git_index_time mtime;
|
88
|
+
|
89
|
+
unsigned int dev;
|
90
|
+
unsigned int ino;
|
91
|
+
unsigned int mode;
|
92
|
+
unsigned int uid;
|
93
|
+
unsigned int gid;
|
94
|
+
git_off_t file_size;
|
95
|
+
|
96
|
+
git_oid oid;
|
97
|
+
|
98
|
+
unsigned short flags;
|
99
|
+
unsigned short flags_extended;
|
100
|
+
|
101
|
+
char *path;
|
102
|
+
} git_index_entry;
|
103
|
+
|
104
|
+
|
105
|
+
/**
|
106
|
+
* Create a new Git index object as a memory representation
|
107
|
+
* of the Git index file in 'index_path', without a repository
|
108
|
+
* to back it.
|
109
|
+
*
|
110
|
+
* Since there is no ODB behind this index, any Index methods
|
111
|
+
* which rely on the ODB (e.g. index_add) will fail with the
|
112
|
+
* GIT_EBAREINDEX error code.
|
113
|
+
*
|
114
|
+
* @param index the pointer for the new index
|
115
|
+
* @param index_path the path to the index file in disk
|
116
|
+
* @return 0 on success; error code otherwise
|
117
|
+
*/
|
118
|
+
GIT_EXTERN(int) git_index_open_bare(git_index **index, const char *index_path);
|
119
|
+
|
120
|
+
/**
|
121
|
+
* Open the Index inside the git repository pointed
|
122
|
+
* by 'repo'.
|
123
|
+
*
|
124
|
+
* @param index the pointer for the new index
|
125
|
+
* @param repo the git repo which owns the index
|
126
|
+
* @return 0 on success; error code otherwise
|
127
|
+
*/
|
128
|
+
GIT_EXTERN(int) git_index_open_inrepo(git_index **index, git_repository *repo);
|
129
|
+
|
130
|
+
/**
|
131
|
+
* Clear the contents (all the entries) of an index object.
|
132
|
+
* This clears the index object in memory; changes must be manually
|
133
|
+
* written to disk for them to take effect.
|
134
|
+
*
|
135
|
+
* @param index an existing index object
|
136
|
+
*/
|
137
|
+
GIT_EXTERN(void) git_index_clear(git_index *index);
|
138
|
+
|
139
|
+
/**
|
140
|
+
* Free an existing index object.
|
141
|
+
*
|
142
|
+
* @param index an existing index object
|
143
|
+
*/
|
144
|
+
GIT_EXTERN(void) git_index_free(git_index *index);
|
145
|
+
|
146
|
+
/**
|
147
|
+
* Update the contents of an existing index object in memory
|
148
|
+
* by reading from the hard disk.
|
149
|
+
*
|
150
|
+
* @param index an existing index object
|
151
|
+
* @return 0 on success, otherwise an error code
|
152
|
+
*/
|
153
|
+
GIT_EXTERN(int) git_index_read(git_index *index);
|
154
|
+
|
155
|
+
/**
|
156
|
+
* Write an existing index object from memory back to disk
|
157
|
+
* using an atomic file lock.
|
158
|
+
*
|
159
|
+
* @param index an existing index object
|
160
|
+
* @return 0 on success, otherwise an error code
|
161
|
+
*/
|
162
|
+
GIT_EXTERN(int) git_index_write(git_index *index);
|
163
|
+
|
164
|
+
/**
|
165
|
+
* Find the first index of any entries which point to given
|
166
|
+
* path in the Git index.
|
167
|
+
*
|
168
|
+
* @param index an existing index object
|
169
|
+
* @param path path to search
|
170
|
+
* @return an index >= 0 if found, -1 otherwise
|
171
|
+
*/
|
172
|
+
GIT_EXTERN(int) git_index_find(git_index *index, const char *path);
|
173
|
+
|
174
|
+
/**
|
175
|
+
* Add or update an index entry from a file in disk
|
176
|
+
*
|
177
|
+
* The file `path` must be relative to the repository's
|
178
|
+
* working folder and must be readable.
|
179
|
+
*
|
180
|
+
* This method will fail in bare index instances.
|
181
|
+
*
|
182
|
+
* @param index an existing index object
|
183
|
+
* @param path filename to add
|
184
|
+
* @param stage stage for the entry
|
185
|
+
* @return 0 on success, otherwise an error code
|
186
|
+
*/
|
187
|
+
GIT_EXTERN(int) git_index_add(git_index *index, const char *path, int stage);
|
188
|
+
|
189
|
+
/**
|
190
|
+
* Add or update an index entry from an in-memory struct
|
191
|
+
*
|
192
|
+
* A full copy (including the 'path' string) of the given
|
193
|
+
* 'source_entry' will be inserted on the index.
|
194
|
+
*
|
195
|
+
* @param index an existing index object
|
196
|
+
* @param source_entry new entry object
|
197
|
+
* @return 0 on success, otherwise an error code
|
198
|
+
*/
|
199
|
+
GIT_EXTERN(int) git_index_add2(git_index *index, const git_index_entry *source_entry);
|
200
|
+
|
201
|
+
/**
|
202
|
+
* Add (append) an index entry from a file in disk
|
203
|
+
*
|
204
|
+
* A new entry will always be inserted into the index;
|
205
|
+
* if the index already contains an entry for such
|
206
|
+
* path, the old entry will **not** be replaced.
|
207
|
+
*
|
208
|
+
* The file `path` must be relative to the repository's
|
209
|
+
* working folder and must be readable.
|
210
|
+
*
|
211
|
+
* This method will fail in bare index instances.
|
212
|
+
*
|
213
|
+
* @param index an existing index object
|
214
|
+
* @param path filename to add
|
215
|
+
* @param stage stage for the entry
|
216
|
+
* @return 0 on success, otherwise an error code
|
217
|
+
*/
|
218
|
+
GIT_EXTERN(int) git_index_append(git_index *index, const char *path, int stage);
|
219
|
+
|
220
|
+
/**
|
221
|
+
* Add (append) an index entry from an in-memory struct
|
222
|
+
*
|
223
|
+
* A new entry will always be inserted into the index;
|
224
|
+
* if the index already contains an entry for the path
|
225
|
+
* in the `entry` struct, the old entry will **not** be
|
226
|
+
* replaced.
|
227
|
+
*
|
228
|
+
* A full copy (including the 'path' string) of the given
|
229
|
+
* 'source_entry' will be inserted on the index.
|
230
|
+
*
|
231
|
+
* @param index an existing index object
|
232
|
+
* @param source_entry new entry object
|
233
|
+
* @return 0 on success, otherwise an error code
|
234
|
+
*/
|
235
|
+
GIT_EXTERN(int) git_index_append2(git_index *index, const git_index_entry *source_entry);
|
236
|
+
|
237
|
+
/**
|
238
|
+
* Remove an entry from the index
|
239
|
+
*
|
240
|
+
* @param index an existing index object
|
241
|
+
* @param position position of the entry to remove
|
242
|
+
* @return 0 on success, otherwise an error code
|
243
|
+
*/
|
244
|
+
GIT_EXTERN(int) git_index_remove(git_index *index, int position);
|
245
|
+
|
246
|
+
|
247
|
+
/**
|
248
|
+
* Get a pointer to one of the entries in the index
|
249
|
+
*
|
250
|
+
* This entry can be modified, and the changes will be written
|
251
|
+
* back to disk on the next write() call.
|
252
|
+
*
|
253
|
+
* @param index an existing index object
|
254
|
+
* @param n the position of the entry
|
255
|
+
* @return a pointer to the entry; NULL if out of bounds
|
256
|
+
*/
|
257
|
+
GIT_EXTERN(git_index_entry *) git_index_get(git_index *index, int n);
|
258
|
+
|
259
|
+
/**
|
260
|
+
* Get the count of entries currently in the index
|
261
|
+
*
|
262
|
+
* @param index an existing index object
|
263
|
+
* @return integer of count of current entries
|
264
|
+
*/
|
265
|
+
GIT_EXTERN(unsigned int) git_index_entrycount(git_index *index);
|
266
|
+
|
267
|
+
|
268
|
+
/** @} */
|
269
|
+
GIT_END_DECL
|
270
|
+
#endif
|