author | Lars Hjemli <hjemli@gmail.com> | 2006-12-12 23:13:27 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2006-12-12 23:13:27 (UTC) |
commit | 06fe0c2f47eaf467db8ab1443e61dfa1c280f30a (patch) (unidiff) | |
tree | 481164eeeeb5ca3302f7b3d38d1debbad9db9296 /git.h | |
parent | 58d04f6523b0029281d65f841859fa42d0c744ff (diff) | |
download | cgit-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>
-rw-r--r-- | git.h | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -143,96 +143,109 @@ extern char *sha1_to_hex(const unsigned char *sha1); /* static buffer result! */ | |||
143 | */ | 143 | */ |
144 | 144 | ||
145 | struct object_list { | 145 | struct object_list { |
146 | struct object *item; | 146 | struct object *item; |
147 | struct object_list *next; | 147 | struct object_list *next; |
148 | }; | 148 | }; |
149 | 149 | ||
150 | struct object_refs { | 150 | struct 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 | ||
156 | struct object_array { | 156 | struct 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 | */ |
171 | struct object { | 171 | struct 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 | ||
184 | struct tree { | 184 | struct 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 | ||
191 | struct tree *lookup_tree(const unsigned char *sha1); | ||
192 | int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size); | ||
193 | int parse_tree(struct tree *tree); | ||
194 | struct tree *parse_tree_indirect(const unsigned char *sha1); | ||
195 | |||
196 | typedef int (*read_tree_fn_t)(const unsigned char *, const char *, int, const char *, unsigned int, int); | ||
197 | |||
198 | extern 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 | |||
203 | extern 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 | ||
195 | struct commit_list { | 208 | struct commit_list { |
196 | struct commit *item; | 209 | struct commit *item; |
197 | struct commit_list *next; | 210 | struct commit_list *next; |
198 | }; | 211 | }; |
199 | 212 | ||
200 | struct commit { | 213 | struct 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 | ||
210 | struct commit *lookup_commit(const unsigned char *sha1); | 223 | struct commit *lookup_commit(const unsigned char *sha1); |
211 | struct commit *lookup_commit_reference(const unsigned char *sha1); | 224 | struct commit *lookup_commit_reference(const unsigned char *sha1); |
212 | struct commit *lookup_commit_reference_gently(const unsigned char *sha1, | 225 | struct commit *lookup_commit_reference_gently(const unsigned char *sha1, |
213 | int quiet); | 226 | int quiet); |
214 | 227 | ||
215 | int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size); | 228 | int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size); |
216 | int parse_commit(struct commit *item); | 229 | int parse_commit(struct commit *item); |
217 | 230 | ||
218 | struct commit_list * commit_list_insert(struct commit *item, struct commit_list **list_p); | 231 | struct commit_list * commit_list_insert(struct commit *item, struct commit_list **list_p); |
219 | struct commit_list * insert_by_date(struct commit *item, struct commit_list **list); | 232 | struct commit_list * insert_by_date(struct commit *item, struct commit_list **list); |
220 | 233 | ||
221 | void free_commit_list(struct commit_list *list); | 234 | void free_commit_list(struct commit_list *list); |
222 | 235 | ||
223 | void sort_by_date(struct commit_list **list); | 236 | void sort_by_date(struct commit_list **list); |
224 | 237 | ||
225 | /* Commit formats */ | 238 | /* Commit formats */ |
226 | enum cmit_fmt { | 239 | enum 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 | ||