summaryrefslogtreecommitdiffabout
path: root/git.h
authorLars Hjemli <hjemli@gmail.com>2006-12-12 23:13:27 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2006-12-12 23:13:27 (UTC)
commit06fe0c2f47eaf467db8ab1443e61dfa1c280f30a (patch) (unidiff)
tree481164eeeeb5ca3302f7b3d38d1debbad9db9296 /git.h
parent58d04f6523b0029281d65f841859fa42d0c744ff (diff)
downloadcgit-06fe0c2f47eaf467db8ab1443e61dfa1c280f30a.zip
cgit-06fe0c2f47eaf467db8ab1443e61dfa1c280f30a.tar.gz
cgit-06fe0c2f47eaf467db8ab1443e61dfa1c280f30a.tar.bz2
Add display of tree content w/ui-tree.c
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'git.h') (more/less context) (show whitespace changes)
-rw-r--r--git.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/git.h b/git.h
index dfa3542..a3f977c 100644
--- a/git.h
+++ b/git.h
@@ -143,96 +143,109 @@ extern char *sha1_to_hex(const unsigned char *sha1); /* static buffer result! */
143 */ 143 */
144 144
145struct object_list { 145struct object_list {
146 struct object *item; 146 struct object *item;
147 struct object_list *next; 147 struct object_list *next;
148}; 148};
149 149
150struct object_refs { 150struct object_refs {
151 unsigned count; 151 unsigned count;
152 struct object *base; 152 struct object *base;
153 struct object *ref[FLEX_ARRAY]; /* more */ 153 struct object *ref[FLEX_ARRAY]; /* more */
154}; 154};
155 155
156struct object_array { 156struct object_array {
157 unsigned int nr; 157 unsigned int nr;
158 unsigned int alloc; 158 unsigned int alloc;
159 struct object_array_entry { 159 struct object_array_entry {
160 struct object *item; 160 struct object *item;
161 const char *name; 161 const char *name;
162 } *objects; 162 } *objects;
163}; 163};
164 164
165#define TYPE_BITS 3 165#define TYPE_BITS 3
166#define FLAG_BITS 27 166#define FLAG_BITS 27
167 167
168/* 168/*
169 * The object type is stored in 3 bits. 169 * The object type is stored in 3 bits.
170 */ 170 */
171struct object { 171struct object {
172 unsigned parsed : 1; 172 unsigned parsed : 1;
173 unsigned used : 1; 173 unsigned used : 1;
174 unsigned type : TYPE_BITS; 174 unsigned type : TYPE_BITS;
175 unsigned flags : FLAG_BITS; 175 unsigned flags : FLAG_BITS;
176 unsigned char sha1[20]; 176 unsigned char sha1[20];
177}; 177};
178 178
179 179
180/* 180/*
181 * from git:tree.h 181 * from git:tree.h
182 */ 182 */
183 183
184struct tree { 184struct tree {
185 struct object object; 185 struct object object;
186 void *buffer; 186 void *buffer;
187 unsigned long size; 187 unsigned long size;
188}; 188};
189 189
190 190
191struct tree *lookup_tree(const unsigned char *sha1);
192int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size);
193int parse_tree(struct tree *tree);
194struct tree *parse_tree_indirect(const unsigned char *sha1);
195
196typedef int (*read_tree_fn_t)(const unsigned char *, const char *, int, const char *, unsigned int, int);
197
198extern int read_tree_recursive(struct tree *tree,
199 const char *base, int baselen,
200 int stage, const char **match,
201 read_tree_fn_t fn);
202
203extern int read_tree(struct tree *tree, int stage, const char **paths);
191 204
192 205
193/* from git:commit.h */ 206/* from git:commit.h */
194 207
195struct commit_list { 208struct commit_list {
196 struct commit *item; 209 struct commit *item;
197 struct commit_list *next; 210 struct commit_list *next;
198}; 211};
199 212
200struct commit { 213struct commit {
201 struct object object; 214 struct object object;
202 void *util; 215 void *util;
203 unsigned long date; 216 unsigned long date;
204 struct commit_list *parents; 217 struct commit_list *parents;
205 struct tree *tree; 218 struct tree *tree;
206 char *buffer; 219 char *buffer;
207}; 220};
208 221
209 222
210struct commit *lookup_commit(const unsigned char *sha1); 223struct commit *lookup_commit(const unsigned char *sha1);
211struct commit *lookup_commit_reference(const unsigned char *sha1); 224struct commit *lookup_commit_reference(const unsigned char *sha1);
212struct commit *lookup_commit_reference_gently(const unsigned char *sha1, 225struct commit *lookup_commit_reference_gently(const unsigned char *sha1,
213 int quiet); 226 int quiet);
214 227
215int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size); 228int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size);
216int parse_commit(struct commit *item); 229int parse_commit(struct commit *item);
217 230
218struct commit_list * commit_list_insert(struct commit *item, struct commit_list **list_p); 231struct commit_list * commit_list_insert(struct commit *item, struct commit_list **list_p);
219struct commit_list * insert_by_date(struct commit *item, struct commit_list **list); 232struct commit_list * insert_by_date(struct commit *item, struct commit_list **list);
220 233
221void free_commit_list(struct commit_list *list); 234void free_commit_list(struct commit_list *list);
222 235
223void sort_by_date(struct commit_list **list); 236void sort_by_date(struct commit_list **list);
224 237
225/* Commit formats */ 238/* Commit formats */
226enum cmit_fmt { 239enum cmit_fmt {
227 CMIT_FMT_RAW, 240 CMIT_FMT_RAW,
228 CMIT_FMT_MEDIUM, 241 CMIT_FMT_MEDIUM,
229 CMIT_FMT_DEFAULT = CMIT_FMT_MEDIUM, 242 CMIT_FMT_DEFAULT = CMIT_FMT_MEDIUM,
230 CMIT_FMT_SHORT, 243 CMIT_FMT_SHORT,
231 CMIT_FMT_FULL, 244 CMIT_FMT_FULL,
232 CMIT_FMT_FULLER, 245 CMIT_FMT_FULLER,
233 CMIT_FMT_ONELINE, 246 CMIT_FMT_ONELINE,
234 CMIT_FMT_EMAIL, 247 CMIT_FMT_EMAIL,
235 248
236 CMIT_FMT_UNSPECIFIED, 249 CMIT_FMT_UNSPECIFIED,
237}; 250};
238 251