File: gitlib.h

package info (click to toggle)
darcs 1.0.9~rc1-0.1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 4,248 kB
  • ctags: 565
  • sloc: haskell: 19,148; perl: 4,320; sh: 1,626; ansic: 1,137; makefile: 55; xml: 14
file content (83 lines) | stat: -rw-r--r-- 2,567 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
 Copyright (C) 2005 Juliusz Chroboczek

 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2, or (at your option)
 any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software Foundation,
 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/



#include "cache.h"

struct git_file {
    unsigned char *data;
    char *type;
    unsigned long length;
};

struct git_file_info {
    unsigned int mode;
    char *name;
    unsigned char sha1[20];
};

struct git_tree_iterator {
    unsigned char *data;
    unsigned long length;
    unsigned long offset;
};

struct git_tree_element {
    char *name;
    unsigned mode;
    char sha1[20];
};

struct git_write_iterator {
    int count;
    int size;
    struct git_tree_element *elts;
};

struct git_file *git_read_file(const unsigned char *sha1);
void git_file_done(struct git_file *f);
unsigned char *git_head(char *);
int git_update_head(char*, char *);

void git_file_info_done(struct git_file_info *info);
unsigned int git_default_file_mode(unsigned int treep);
int git_is_tree(unsigned int mode);

struct git_tree_iterator *
git_tree_begin(unsigned char *data, unsigned long length);
struct git_file_info *git_tree_next(struct git_tree_iterator *iter);
void git_tree_done(struct git_tree_iterator *iter);
char *git_parse_time(unsigned long sec);
unsigned long git_format_time(char *string);

unsigned char *git_cache_entry_sha1(struct cache_entry *entry);
unsigned int git_cache_entry_size(struct cache_entry *entry);
unsigned int git_cache_entry_mtime(struct cache_entry *entry);
struct cache_entry *git_cache_entry(char *name);

int git_validate(char *string, char *sha_b, int n);

struct git_file_info *
git_write_file(char *type, char *name, unsigned mode,
               char *contents, unsigned int length);
struct git_write_iterator *git_write_tree_begin(void);
int git_write_tree_next(struct git_write_iterator *iter,
                        char *name, unsigned mode, char *sha1_s);
struct git_file_info *git_write_tree_done(struct git_write_iterator *iter,
                                          char *name, unsigned mode);