Linus Torvalds | e83c516 | 2005-04-07 15:13:13 -0700 | [diff] [blame] | 1 | #ifndef CACHE_H |
| 2 | #define CACHE_H |
| 3 | |
Junio C Hamano | 4050c0d | 2005-12-05 11:54:29 -0800 | [diff] [blame] | 4 | #include "git-compat-util.h" |
Pierre Habouzit | 5ecd293 | 2007-09-16 15:51:04 +0200 | [diff] [blame] | 5 | #include "strbuf.h" |
Linus Torvalds | cf55870 | 2008-01-22 18:41:14 -0800 | [diff] [blame] | 6 | #include "hash.h" |
Jeff King | 7519443 | 2009-09-09 07:38:58 -0400 | [diff] [blame] | 7 | #include "advice.h" |
Linus Torvalds | e83c516 | 2005-04-07 15:13:13 -0700 | [diff] [blame] | 8 | |
Linus Torvalds | cef661f | 2005-04-21 12:33:22 -0700 | [diff] [blame] | 9 | #include SHA1_HEADER |
Nicolas Pitre | 9126f00 | 2008-10-01 14:05:20 -0400 | [diff] [blame] | 10 | #ifndef git_SHA_CTX |
| 11 | #define git_SHA_CTX SHA_CTX |
| 12 | #define git_SHA1_Init SHA1_Init |
| 13 | #define git_SHA1_Update SHA1_Update |
| 14 | #define git_SHA1_Final SHA1_Final |
| 15 | #endif |
Linus Torvalds | e83c516 | 2005-04-07 15:13:13 -0700 | [diff] [blame] | 16 | |
Nicolas Pitre | 9126f00 | 2008-10-01 14:05:20 -0400 | [diff] [blame] | 17 | #include <zlib.h> |
David Symonds | 609a228 | 2007-11-07 14:24:28 +1100 | [diff] [blame] | 18 | #if defined(NO_DEFLATE_BOUND) || ZLIB_VERNUM < 0x1200 |
Edgar Toernig | 9da3acf | 2005-04-30 09:51:03 -0700 | [diff] [blame] | 19 | #define deflateBound(c,s) ((s) + (((s) + 7) >> 3) + (((s) + 63) >> 6) + 11) |
| 20 | #endif |
| 21 | |
Linus Torvalds | 39c6854 | 2009-01-07 19:54:47 -0800 | [diff] [blame] | 22 | void git_inflate_init(z_streamp strm); |
| 23 | void git_inflate_end(z_streamp strm); |
| 24 | int git_inflate(z_streamp strm, int flush); |
| 25 | |
Timo Hirvonen | 962554c | 2006-02-26 17:13:46 +0200 | [diff] [blame] | 26 | #if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT) |
Edgar Toernig | b682969 | 2005-04-30 09:51:03 -0700 | [diff] [blame] | 27 | #define DTYPE(de) ((de)->d_type) |
| 28 | #else |
Junio C Hamano | 0bdd79a | 2006-01-20 13:33:20 -0800 | [diff] [blame] | 29 | #undef DT_UNKNOWN |
| 30 | #undef DT_DIR |
| 31 | #undef DT_REG |
| 32 | #undef DT_LNK |
Edgar Toernig | b682969 | 2005-04-30 09:51:03 -0700 | [diff] [blame] | 33 | #define DT_UNKNOWN 0 |
| 34 | #define DT_DIR 1 |
| 35 | #define DT_REG 2 |
Junio C Hamano | a15c1c6 | 2005-05-12 17:16:04 -0700 | [diff] [blame] | 36 | #define DT_LNK 3 |
Edgar Toernig | b682969 | 2005-04-30 09:51:03 -0700 | [diff] [blame] | 37 | #define DTYPE(de) DT_UNKNOWN |
| 38 | #endif |
| 39 | |
Martin Koegler | 40689ae | 2007-04-22 18:43:56 +0200 | [diff] [blame] | 40 | /* unknown mode (impossible combination S_IFIFO|S_IFCHR) */ |
| 41 | #define S_IFINVALID 0030000 |
| 42 | |
Linus Torvalds | e83c516 | 2005-04-07 15:13:13 -0700 | [diff] [blame] | 43 | /* |
Linus Torvalds | 9eec479 | 2007-04-09 21:14:58 -0700 | [diff] [blame] | 44 | * A "directory link" is a link to another git directory. |
| 45 | * |
| 46 | * The value 0160000 is not normally a valid mode, and |
| 47 | * also just happens to be S_IFDIR + S_IFLNK |
| 48 | * |
| 49 | * NOTE! We *really* shouldn't depend on the S_IFxxx macros |
| 50 | * always having the same values everywhere. We should use |
| 51 | * our internal git values for these things, and then we can |
| 52 | * translate that to the OS-specific value. It just so |
| 53 | * happens that everybody shares the same bit representation |
| 54 | * in the UNIX world (and apparently wider too..) |
| 55 | */ |
Martin Waitz | 302b928 | 2007-05-21 22:08:28 +0200 | [diff] [blame] | 56 | #define S_IFGITLINK 0160000 |
| 57 | #define S_ISGITLINK(m) (((m) & S_IFMT) == S_IFGITLINK) |
Linus Torvalds | 9eec479 | 2007-04-09 21:14:58 -0700 | [diff] [blame] | 58 | |
| 59 | /* |
Linus Torvalds | 2386d65 | 2005-07-13 18:46:20 -0700 | [diff] [blame] | 60 | * Intensive research over the course of many years has shown that |
| 61 | * port 9418 is totally unused by anything else. Or |
| 62 | * |
| 63 | * Your search - "port 9418" - did not match any documents. |
| 64 | * |
| 65 | * as www.google.com puts it. |
Linus Torvalds | ba8a497 | 2005-09-12 11:23:00 -0700 | [diff] [blame] | 66 | * |
| 67 | * This port has been properly assigned for git use by IANA: |
| 68 | * git (Assigned-9418) [I06-050728-0001]. |
| 69 | * |
| 70 | * git 9418/tcp git pack transfer service |
| 71 | * git 9418/udp git pack transfer service |
| 72 | * |
| 73 | * with Linus Torvalds <torvalds@osdl.org> as the point of |
| 74 | * contact. September 2005. |
| 75 | * |
| 76 | * See http://www.iana.org/assignments/port-numbers |
Linus Torvalds | 2386d65 | 2005-07-13 18:46:20 -0700 | [diff] [blame] | 77 | */ |
| 78 | #define DEFAULT_GIT_PORT 9418 |
| 79 | |
| 80 | /* |
Linus Torvalds | e83c516 | 2005-04-07 15:13:13 -0700 | [diff] [blame] | 81 | * Basic data structures for the directory cache |
Linus Torvalds | e83c516 | 2005-04-07 15:13:13 -0700 | [diff] [blame] | 82 | */ |
| 83 | |
| 84 | #define CACHE_SIGNATURE 0x44495243 /* "DIRC" */ |
| 85 | struct cache_header { |
Linus Torvalds | ccc4feb | 2005-04-15 10:44:27 -0700 | [diff] [blame] | 86 | unsigned int hdr_signature; |
| 87 | unsigned int hdr_version; |
| 88 | unsigned int hdr_entries; |
Linus Torvalds | e83c516 | 2005-04-07 15:13:13 -0700 | [diff] [blame] | 89 | }; |
| 90 | |
| 91 | /* |
| 92 | * The "cache_time" is just the low 32 bits of the |
| 93 | * time. It doesn't matter if it overflows - we only |
| 94 | * check it for equality in the 32 bits we save. |
| 95 | */ |
| 96 | struct cache_time { |
| 97 | unsigned int sec; |
| 98 | unsigned int nsec; |
| 99 | }; |
| 100 | |
| 101 | /* |
| 102 | * dev/ino/uid/gid/size are also just tracked to the low 32 bits |
| 103 | * Again - this is just a (very strong in practice) heuristic that |
| 104 | * the inode hasn't changed. |
Linus Torvalds | ccc4feb | 2005-04-15 10:44:27 -0700 | [diff] [blame] | 105 | * |
| 106 | * We save the fields in big-endian order to allow using the |
| 107 | * index file over NFS transparently. |
Linus Torvalds | e83c516 | 2005-04-07 15:13:13 -0700 | [diff] [blame] | 108 | */ |
Linus Torvalds | 7a51ed6 | 2008-01-14 16:03:17 -0800 | [diff] [blame] | 109 | struct ondisk_cache_entry { |
| 110 | struct cache_time ctime; |
| 111 | struct cache_time mtime; |
| 112 | unsigned int dev; |
| 113 | unsigned int ino; |
| 114 | unsigned int mode; |
| 115 | unsigned int uid; |
| 116 | unsigned int gid; |
| 117 | unsigned int size; |
| 118 | unsigned char sha1[20]; |
| 119 | unsigned short flags; |
| 120 | char name[FLEX_ARRAY]; /* more */ |
| 121 | }; |
| 122 | |
Nguyễn Thái Ngọc Duy | 06aaaa0 | 2008-10-01 11:04:01 +0700 | [diff] [blame] | 123 | /* |
| 124 | * This struct is used when CE_EXTENDED bit is 1 |
| 125 | * The struct must match ondisk_cache_entry exactly from |
| 126 | * ctime till flags |
| 127 | */ |
| 128 | struct ondisk_cache_entry_extended { |
| 129 | struct cache_time ctime; |
| 130 | struct cache_time mtime; |
| 131 | unsigned int dev; |
| 132 | unsigned int ino; |
| 133 | unsigned int mode; |
| 134 | unsigned int uid; |
| 135 | unsigned int gid; |
| 136 | unsigned int size; |
| 137 | unsigned char sha1[20]; |
| 138 | unsigned short flags; |
| 139 | unsigned short flags2; |
| 140 | char name[FLEX_ARRAY]; /* more */ |
| 141 | }; |
| 142 | |
Linus Torvalds | e83c516 | 2005-04-07 15:13:13 -0700 | [diff] [blame] | 143 | struct cache_entry { |
Kjetil Barvik | fba2f38 | 2009-02-19 21:08:29 +0100 | [diff] [blame] | 144 | struct cache_time ce_ctime; |
| 145 | struct cache_time ce_mtime; |
Linus Torvalds | ccc4feb | 2005-04-15 10:44:27 -0700 | [diff] [blame] | 146 | unsigned int ce_dev; |
| 147 | unsigned int ce_ino; |
| 148 | unsigned int ce_mode; |
| 149 | unsigned int ce_uid; |
| 150 | unsigned int ce_gid; |
| 151 | unsigned int ce_size; |
Linus Torvalds | 7a51ed6 | 2008-01-14 16:03:17 -0800 | [diff] [blame] | 152 | unsigned int ce_flags; |
Linus Torvalds | e83c516 | 2005-04-07 15:13:13 -0700 | [diff] [blame] | 153 | unsigned char sha1[20]; |
Linus Torvalds | eb7a2f1 | 2008-02-22 20:41:17 -0800 | [diff] [blame] | 154 | struct cache_entry *next; |
Junio C Hamano | 8f1d2e6 | 2006-01-07 01:33:54 -0800 | [diff] [blame] | 155 | char name[FLEX_ARRAY]; /* more */ |
Linus Torvalds | e83c516 | 2005-04-07 15:13:13 -0700 | [diff] [blame] | 156 | }; |
| 157 | |
Linus Torvalds | 95fd5bf | 2005-04-15 22:51:44 -0700 | [diff] [blame] | 158 | #define CE_NAMEMASK (0x0fff) |
| 159 | #define CE_STAGEMASK (0x3000) |
Junio C Hamano | 16ce2e4 | 2008-08-16 23:02:08 -0700 | [diff] [blame] | 160 | #define CE_EXTENDED (0x4000) |
Junio C Hamano | 5f73076 | 2006-02-08 21:15:24 -0800 | [diff] [blame] | 161 | #define CE_VALID (0x8000) |
Junio C Hamano | aee4619 | 2005-04-16 08:33:23 -0700 | [diff] [blame] | 162 | #define CE_STAGESHIFT 12 |
Linus Torvalds | 95fd5bf | 2005-04-15 22:51:44 -0700 | [diff] [blame] | 163 | |
Nguyễn Thái Ngọc Duy | 06aaaa0 | 2008-10-01 11:04:01 +0700 | [diff] [blame] | 164 | /* |
| 165 | * Range 0xFFFF0000 in ce_flags is divided into |
| 166 | * two parts: in-memory flags and on-disk ones. |
| 167 | * Flags in CE_EXTENDED_FLAGS will get saved on-disk |
| 168 | * if you want to save a new flag, add it in |
| 169 | * CE_EXTENDED_FLAGS |
| 170 | * |
| 171 | * In-memory only flags |
| 172 | */ |
Linus Torvalds | 7a51ed6 | 2008-01-14 16:03:17 -0800 | [diff] [blame] | 173 | #define CE_UPDATE (0x10000) |
| 174 | #define CE_REMOVE (0x20000) |
Junio C Hamano | eadb583 | 2008-01-18 23:45:24 -0800 | [diff] [blame] | 175 | #define CE_UPTODATE (0x40000) |
Linus Torvalds | 1102952 | 2008-03-22 14:22:44 -0700 | [diff] [blame] | 176 | #define CE_ADDED (0x80000) |
Linus Torvalds | a22c637 | 2008-02-22 20:37:40 -0800 | [diff] [blame] | 177 | |
| 178 | #define CE_HASHED (0x100000) |
| 179 | #define CE_UNHASHED (0x200000) |
Junio C Hamano | bf96c93 | 2010-01-04 00:02:00 -0800 | [diff] [blame] | 180 | #define CE_CONFLICTED (0x800000) |
Linus Torvalds | 7a51ed6 | 2008-01-14 16:03:17 -0800 | [diff] [blame] | 181 | |
Nguyễn Thái Ngọc Duy | 700e66d | 2010-07-31 13:14:27 +0700 | [diff] [blame] | 182 | #define CE_WT_REMOVE (0x400000) /* remove in work directory */ |
Nguyễn Thái Ngọc Duy | e663db2 | 2009-08-20 20:47:06 +0700 | [diff] [blame] | 183 | |
Junio C Hamano | da165f4 | 2010-01-07 14:59:54 -0800 | [diff] [blame] | 184 | #define CE_UNPACKED (0x1000000) |
| 185 | |
Linus Torvalds | d070e3a | 2008-02-22 20:39:21 -0800 | [diff] [blame] | 186 | /* |
Nguyễn Thái Ngọc Duy | 06aaaa0 | 2008-10-01 11:04:01 +0700 | [diff] [blame] | 187 | * Extended on-disk flags |
| 188 | */ |
Junio C Hamano | 388b2ac | 2008-11-28 19:55:25 -0800 | [diff] [blame] | 189 | #define CE_INTENT_TO_ADD 0x20000000 |
Nguyễn Thái Ngọc Duy | 44a3691 | 2009-08-20 20:46:57 +0700 | [diff] [blame] | 190 | #define CE_SKIP_WORKTREE 0x40000000 |
Nguyễn Thái Ngọc Duy | 06aaaa0 | 2008-10-01 11:04:01 +0700 | [diff] [blame] | 191 | /* CE_EXTENDED2 is for future extension */ |
| 192 | #define CE_EXTENDED2 0x80000000 |
| 193 | |
Nguyễn Thái Ngọc Duy | 44a3691 | 2009-08-20 20:46:57 +0700 | [diff] [blame] | 194 | #define CE_EXTENDED_FLAGS (CE_INTENT_TO_ADD | CE_SKIP_WORKTREE) |
Nguyễn Thái Ngọc Duy | 06aaaa0 | 2008-10-01 11:04:01 +0700 | [diff] [blame] | 195 | |
| 196 | /* |
| 197 | * Safeguard to avoid saving wrong flags: |
| 198 | * - CE_EXTENDED2 won't get saved until its semantic is known |
| 199 | * - Bits in 0x0000FFFF have been saved in ce_flags already |
| 200 | * - Bits in 0x003F0000 are currently in-memory flags |
| 201 | */ |
| 202 | #if CE_EXTENDED_FLAGS & 0x803FFFFF |
| 203 | #error "CE_EXTENDED_FLAGS out of range" |
| 204 | #endif |
| 205 | |
| 206 | /* |
Linus Torvalds | eb7a2f1 | 2008-02-22 20:41:17 -0800 | [diff] [blame] | 207 | * Copy the sha1 and stat state of a cache entry from one to |
| 208 | * another. But we never change the name, or the hash state! |
| 209 | */ |
| 210 | #define CE_STATE_MASK (CE_HASHED | CE_UNHASHED) |
| 211 | static inline void copy_cache_entry(struct cache_entry *dst, struct cache_entry *src) |
| 212 | { |
| 213 | unsigned int state = dst->ce_flags & CE_STATE_MASK; |
| 214 | |
| 215 | /* Don't copy hash chain and name */ |
| 216 | memcpy(dst, src, offsetof(struct cache_entry, next)); |
| 217 | |
| 218 | /* Restore the hash state */ |
| 219 | dst->ce_flags = (dst->ce_flags & ~CE_STATE_MASK) | state; |
| 220 | } |
| 221 | |
Junio C Hamano | 7fec10b | 2008-01-18 23:42:00 -0800 | [diff] [blame] | 222 | static inline unsigned create_ce_flags(size_t len, unsigned stage) |
| 223 | { |
| 224 | if (len >= CE_NAMEMASK) |
| 225 | len = CE_NAMEMASK; |
| 226 | return (len | (stage << CE_STAGESHIFT)); |
| 227 | } |
| 228 | |
| 229 | static inline size_t ce_namelen(const struct cache_entry *ce) |
| 230 | { |
| 231 | size_t len = ce->ce_flags & CE_NAMEMASK; |
| 232 | if (len < CE_NAMEMASK) |
| 233 | return len; |
| 234 | return strlen(ce->name + CE_NAMEMASK) + CE_NAMEMASK; |
| 235 | } |
| 236 | |
Junio C Hamano | aee4619 | 2005-04-16 08:33:23 -0700 | [diff] [blame] | 237 | #define ce_size(ce) cache_entry_size(ce_namelen(ce)) |
Nguyễn Thái Ngọc Duy | 06aaaa0 | 2008-10-01 11:04:01 +0700 | [diff] [blame] | 238 | #define ondisk_ce_size(ce) (((ce)->ce_flags & CE_EXTENDED) ? \ |
| 239 | ondisk_cache_entry_extended_size(ce_namelen(ce)) : \ |
| 240 | ondisk_cache_entry_size(ce_namelen(ce))) |
Linus Torvalds | 7a51ed6 | 2008-01-14 16:03:17 -0800 | [diff] [blame] | 241 | #define ce_stage(ce) ((CE_STAGEMASK & (ce)->ce_flags) >> CE_STAGESHIFT) |
Junio C Hamano | eadb583 | 2008-01-18 23:45:24 -0800 | [diff] [blame] | 242 | #define ce_uptodate(ce) ((ce)->ce_flags & CE_UPTODATE) |
Nguyễn Thái Ngọc Duy | 44a3691 | 2009-08-20 20:46:57 +0700 | [diff] [blame] | 243 | #define ce_skip_worktree(ce) ((ce)->ce_flags & CE_SKIP_WORKTREE) |
Junio C Hamano | eadb583 | 2008-01-18 23:45:24 -0800 | [diff] [blame] | 244 | #define ce_mark_uptodate(ce) ((ce)->ce_flags |= CE_UPTODATE) |
Junio C Hamano | aee4619 | 2005-04-16 08:33:23 -0700 | [diff] [blame] | 245 | |
Linus Torvalds | e447947 | 2005-04-16 22:26:31 -0700 | [diff] [blame] | 246 | #define ce_permissions(mode) (((mode) & 0100) ? 0755 : 0644) |
Kay Sievers | 8ae0a8c | 2005-05-05 14:38:25 +0200 | [diff] [blame] | 247 | static inline unsigned int create_ce_mode(unsigned int mode) |
| 248 | { |
Kay Sievers | 8ae0a8c | 2005-05-05 14:38:25 +0200 | [diff] [blame] | 249 | if (S_ISLNK(mode)) |
Linus Torvalds | 7a51ed6 | 2008-01-14 16:03:17 -0800 | [diff] [blame] | 250 | return S_IFLNK; |
Martin Waitz | 302b928 | 2007-05-21 22:08:28 +0200 | [diff] [blame] | 251 | if (S_ISDIR(mode) || S_ISGITLINK(mode)) |
Linus Torvalds | 7a51ed6 | 2008-01-14 16:03:17 -0800 | [diff] [blame] | 252 | return S_IFGITLINK; |
| 253 | return S_IFREG | ce_permissions(mode); |
Kay Sievers | 8ae0a8c | 2005-05-05 14:38:25 +0200 | [diff] [blame] | 254 | } |
Junio C Hamano | 185c975 | 2007-02-16 22:43:48 -0800 | [diff] [blame] | 255 | static inline unsigned int ce_mode_from_stat(struct cache_entry *ce, unsigned int mode) |
| 256 | { |
Johannes Sixt | 78a8d64 | 2007-03-02 22:11:30 +0100 | [diff] [blame] | 257 | extern int trust_executable_bit, has_symlinks; |
| 258 | if (!has_symlinks && S_ISREG(mode) && |
Linus Torvalds | 7a51ed6 | 2008-01-14 16:03:17 -0800 | [diff] [blame] | 259 | ce && S_ISLNK(ce->ce_mode)) |
Johannes Sixt | 78a8d64 | 2007-03-02 22:11:30 +0100 | [diff] [blame] | 260 | return ce->ce_mode; |
Junio C Hamano | 185c975 | 2007-02-16 22:43:48 -0800 | [diff] [blame] | 261 | if (!trust_executable_bit && S_ISREG(mode)) { |
Linus Torvalds | 7a51ed6 | 2008-01-14 16:03:17 -0800 | [diff] [blame] | 262 | if (ce && S_ISREG(ce->ce_mode)) |
Junio C Hamano | 185c975 | 2007-02-16 22:43:48 -0800 | [diff] [blame] | 263 | return ce->ce_mode; |
| 264 | return create_ce_mode(0666); |
| 265 | } |
| 266 | return create_ce_mode(mode); |
| 267 | } |
Junio C Hamano | d6b8fc3 | 2008-01-31 01:17:48 -0800 | [diff] [blame] | 268 | static inline int ce_to_dtype(const struct cache_entry *ce) |
| 269 | { |
| 270 | unsigned ce_mode = ntohl(ce->ce_mode); |
| 271 | if (S_ISREG(ce_mode)) |
| 272 | return DT_REG; |
| 273 | else if (S_ISDIR(ce_mode) || S_ISGITLINK(ce_mode)) |
| 274 | return DT_DIR; |
| 275 | else if (S_ISLNK(ce_mode)) |
| 276 | return DT_LNK; |
| 277 | else |
| 278 | return DT_UNKNOWN; |
| 279 | } |
René Scharfe | b90d9b8 | 2010-10-04 12:53:11 +0200 | [diff] [blame] | 280 | static inline unsigned int canon_mode(unsigned int mode) |
| 281 | { |
| 282 | if (S_ISREG(mode)) |
| 283 | return S_IFREG | ce_permissions(mode); |
| 284 | if (S_ISLNK(mode)) |
| 285 | return S_IFLNK; |
| 286 | if (S_ISDIR(mode)) |
| 287 | return S_IFDIR; |
| 288 | return S_IFGITLINK; |
| 289 | } |
Linus Torvalds | e447947 | 2005-04-16 22:26:31 -0700 | [diff] [blame] | 290 | |
Nguyễn Thái Ngọc Duy | 06aaaa0 | 2008-10-01 11:04:01 +0700 | [diff] [blame] | 291 | #define flexible_size(STRUCT,len) ((offsetof(struct STRUCT,name) + (len) + 8) & ~7) |
| 292 | #define cache_entry_size(len) flexible_size(cache_entry,len) |
| 293 | #define ondisk_cache_entry_size(len) flexible_size(ondisk_cache_entry,len) |
| 294 | #define ondisk_cache_entry_extended_size(len) flexible_size(ondisk_cache_entry_extended,len) |
Linus Torvalds | f5cabd1 | 2005-04-15 21:45:38 -0700 | [diff] [blame] | 295 | |
Junio C Hamano | 228e94f | 2007-04-01 18:14:06 -0700 | [diff] [blame] | 296 | struct index_state { |
| 297 | struct cache_entry **cache; |
| 298 | unsigned int cache_nr, cache_alloc, cache_changed; |
Junio C Hamano | cfc5789 | 2009-12-25 00:30:51 -0800 | [diff] [blame] | 299 | struct string_list *resolve_undo; |
Junio C Hamano | 228e94f | 2007-04-01 18:14:06 -0700 | [diff] [blame] | 300 | struct cache_tree *cache_tree; |
Kjetil Barvik | fba2f38 | 2009-02-19 21:08:29 +0100 | [diff] [blame] | 301 | struct cache_time timestamp; |
Linus Torvalds | 7a51ed6 | 2008-01-14 16:03:17 -0800 | [diff] [blame] | 302 | void *alloc; |
Junio C Hamano | 913e0e9 | 2008-08-23 12:57:30 -0700 | [diff] [blame] | 303 | unsigned name_hash_initialized : 1, |
| 304 | initialized : 1; |
Linus Torvalds | cf55870 | 2008-01-22 18:41:14 -0800 | [diff] [blame] | 305 | struct hash_table name_hash; |
Junio C Hamano | 228e94f | 2007-04-01 18:14:06 -0700 | [diff] [blame] | 306 | }; |
| 307 | |
| 308 | extern struct index_state the_index; |
| 309 | |
Linus Torvalds | 96872bc | 2008-03-21 13:16:24 -0700 | [diff] [blame] | 310 | /* Name hashing */ |
| 311 | extern void add_name_hash(struct index_state *istate, struct cache_entry *ce); |
| 312 | /* |
| 313 | * We don't actually *remove* it, we can just mark it invalid so that |
| 314 | * we won't find it in lookups. |
| 315 | * |
| 316 | * Not only would we have to search the lists (simple enough), but |
| 317 | * we'd also have to rehash other hash buckets in case this makes the |
| 318 | * hash bucket empty (common). So it's much better to just mark |
| 319 | * it. |
| 320 | */ |
| 321 | static inline void remove_name_hash(struct cache_entry *ce) |
| 322 | { |
| 323 | ce->ce_flags |= CE_UNHASHED; |
| 324 | } |
| 325 | |
| 326 | |
Junio C Hamano | 4aab5b4 | 2007-04-01 23:26:07 -0700 | [diff] [blame] | 327 | #ifndef NO_THE_INDEX_COMPATIBILITY_MACROS |
Junio C Hamano | 228e94f | 2007-04-01 18:14:06 -0700 | [diff] [blame] | 328 | #define active_cache (the_index.cache) |
| 329 | #define active_nr (the_index.cache_nr) |
| 330 | #define active_alloc (the_index.cache_alloc) |
| 331 | #define active_cache_changed (the_index.cache_changed) |
| 332 | #define active_cache_tree (the_index.cache_tree) |
Linus Torvalds | e83c516 | 2005-04-07 15:13:13 -0700 | [diff] [blame] | 333 | |
Junio C Hamano | 4aab5b4 | 2007-04-01 23:26:07 -0700 | [diff] [blame] | 334 | #define read_cache() read_index(&the_index) |
| 335 | #define read_cache_from(path) read_index_from(&the_index, (path)) |
Linus Torvalds | 671c9b7 | 2008-11-13 16:36:30 -0800 | [diff] [blame] | 336 | #define read_cache_preload(pathspec) read_index_preload(&the_index, (pathspec)) |
Junio C Hamano | fa7b3c2 | 2008-11-12 11:52:35 -0800 | [diff] [blame] | 337 | #define is_cache_unborn() is_index_unborn(&the_index) |
Miklos Vajna | e46bbcf | 2008-06-27 18:21:58 +0200 | [diff] [blame] | 338 | #define read_cache_unmerged() read_index_unmerged(&the_index) |
Junio C Hamano | 4aab5b4 | 2007-04-01 23:26:07 -0700 | [diff] [blame] | 339 | #define write_cache(newfd, cache, entries) write_index(&the_index, (newfd)) |
| 340 | #define discard_cache() discard_index(&the_index) |
Daniel Barkalow | 94a5728 | 2008-02-07 11:40:13 -0500 | [diff] [blame] | 341 | #define unmerged_cache() unmerged_index(&the_index) |
Junio C Hamano | 4aab5b4 | 2007-04-01 23:26:07 -0700 | [diff] [blame] | 342 | #define cache_name_pos(name, namelen) index_name_pos(&the_index,(name),(namelen)) |
| 343 | #define add_cache_entry(ce, option) add_index_entry(&the_index, (ce), (option)) |
Petr Baudis | 81dc230 | 2008-07-21 02:25:56 +0200 | [diff] [blame] | 344 | #define rename_cache_entry_at(pos, new_name) rename_index_entry_at(&the_index, (pos), (new_name)) |
Junio C Hamano | 4aab5b4 | 2007-04-01 23:26:07 -0700 | [diff] [blame] | 345 | #define remove_cache_entry_at(pos) remove_index_entry_at(&the_index, (pos)) |
| 346 | #define remove_file_from_cache(path) remove_file_from_index(&the_index, (path)) |
Junio C Hamano | 38ed1d8 | 2008-05-21 12:04:34 -0700 | [diff] [blame] | 347 | #define add_to_cache(path, st, flags) add_to_index(&the_index, (path), (st), (flags)) |
| 348 | #define add_file_to_cache(path, flags) add_file_to_index(&the_index, (path), (flags)) |
Matthieu Moy | 3deffc5 | 2009-08-21 10:57:59 +0200 | [diff] [blame] | 349 | #define refresh_cache(flags) refresh_index(&the_index, (flags), NULL, NULL, NULL) |
Junio C Hamano | 4bd5b7d | 2007-11-10 00:15:03 -0800 | [diff] [blame] | 350 | #define ce_match_stat(ce, st, options) ie_match_stat(&the_index, (ce), (st), (options)) |
| 351 | #define ce_modified(ce, st, options) ie_modified(&the_index, (ce), (st), (options)) |
Linus Torvalds | cd2fef5 | 2008-03-21 15:55:19 -0700 | [diff] [blame] | 352 | #define cache_name_exists(name, namelen, igncase) index_name_exists(&the_index, (name), (namelen), (igncase)) |
Jeff King | 98fa473 | 2008-10-16 11:07:26 -0400 | [diff] [blame] | 353 | #define cache_name_is_other(name, namelen) index_name_is_other(&the_index, (name), (namelen)) |
Junio C Hamano | cfc5789 | 2009-12-25 00:30:51 -0800 | [diff] [blame] | 354 | #define resolve_undo_clear() resolve_undo_clear_index(&the_index) |
Junio C Hamano | 8aa3856 | 2009-12-25 13:40:02 -0800 | [diff] [blame] | 355 | #define unmerge_cache_entry_at(at) unmerge_index_entry_at(&the_index, at) |
Junio C Hamano | 4421a82 | 2009-12-25 11:57:11 -0800 | [diff] [blame] | 356 | #define unmerge_cache(pathspec) unmerge_index(&the_index, pathspec) |
Junio C Hamano | 4aab5b4 | 2007-04-01 23:26:07 -0700 | [diff] [blame] | 357 | #endif |
Linus Torvalds | e83c516 | 2005-04-07 15:13:13 -0700 | [diff] [blame] | 358 | |
Junio C Hamano | edaec3f | 2007-02-28 11:45:56 -0800 | [diff] [blame] | 359 | enum object_type { |
| 360 | OBJ_BAD = -1, |
| 361 | OBJ_NONE = 0, |
| 362 | OBJ_COMMIT = 1, |
| 363 | OBJ_TREE = 2, |
| 364 | OBJ_BLOB = 3, |
| 365 | OBJ_TAG = 4, |
| 366 | /* 5 for future expansion */ |
| 367 | OBJ_OFS_DELTA = 6, |
| 368 | OBJ_REF_DELTA = 7, |
Martin Koegler | 355885d | 2008-02-25 22:46:04 +0100 | [diff] [blame] | 369 | OBJ_ANY, |
Gary V. Vaughan | 4b05548 | 2010-05-14 09:31:35 +0000 | [diff] [blame] | 370 | OBJ_MAX |
Junio C Hamano | edaec3f | 2007-02-28 11:45:56 -0800 | [diff] [blame] | 371 | }; |
| 372 | |
Junio C Hamano | b45563a | 2007-11-30 22:22:38 -0800 | [diff] [blame] | 373 | static inline enum object_type object_type(unsigned int mode) |
| 374 | { |
| 375 | return S_ISDIR(mode) ? OBJ_TREE : |
| 376 | S_ISGITLINK(mode) ? OBJ_COMMIT : |
| 377 | OBJ_BLOB; |
| 378 | } |
| 379 | |
Junio C Hamano | 8ac069a | 2005-05-09 22:57:58 -0700 | [diff] [blame] | 380 | #define GIT_DIR_ENVIRONMENT "GIT_DIR" |
Matthias Lederhofer | 892c41b | 2007-06-06 09:10:42 +0200 | [diff] [blame] | 381 | #define GIT_WORK_TREE_ENVIRONMENT "GIT_WORK_TREE" |
Junio C Hamano | 8ac069a | 2005-05-09 22:57:58 -0700 | [diff] [blame] | 382 | #define DEFAULT_GIT_DIR_ENVIRONMENT ".git" |
Junio C Hamano | d19938a | 2005-05-09 17:57:56 -0700 | [diff] [blame] | 383 | #define DB_ENVIRONMENT "GIT_OBJECT_DIRECTORY" |
Linus Torvalds | bb233d6 | 2005-04-21 10:55:18 -0700 | [diff] [blame] | 384 | #define INDEX_ENVIRONMENT "GIT_INDEX_FILE" |
Junio C Hamano | 5da5c8f | 2005-07-30 00:58:28 -0700 | [diff] [blame] | 385 | #define GRAFT_ENVIRONMENT "GIT_GRAFT_FILE" |
Junio C Hamano | d4ebc36 | 2006-12-19 01:28:15 -0800 | [diff] [blame] | 386 | #define TEMPLATE_DIR_ENVIRONMENT "GIT_TEMPLATE_DIR" |
| 387 | #define CONFIG_ENVIRONMENT "GIT_CONFIG" |
Jeff King | 2b64fc8 | 2010-08-23 15:16:00 -0400 | [diff] [blame] | 388 | #define CONFIG_DATA_ENVIRONMENT "GIT_CONFIG_PARAMETERS" |
Junio C Hamano | d4ebc36 | 2006-12-19 01:28:15 -0800 | [diff] [blame] | 389 | #define EXEC_PATH_ENVIRONMENT "GIT_EXEC_PATH" |
David Reiss | 0454dd9 | 2008-05-19 23:49:26 -0700 | [diff] [blame] | 390 | #define CEILING_DIRECTORIES_ENVIRONMENT "GIT_CEILING_DIRECTORIES" |
Christian Couder | 6476b38 | 2009-11-18 07:50:58 +0100 | [diff] [blame] | 391 | #define NO_REPLACE_OBJECTS_ENVIRONMENT "GIT_NO_REPLACE_OBJECTS" |
Junio C Hamano | d0bfd02 | 2007-04-12 01:07:32 -0700 | [diff] [blame] | 392 | #define GITATTRIBUTES_FILE ".gitattributes" |
| 393 | #define INFOATTRIBUTES_FILE "info/attributes" |
Junio C Hamano | f48fd68 | 2007-04-14 08:54:37 -0700 | [diff] [blame] | 394 | #define ATTRIBUTE_MACRO_PREFIX "[attr]" |
Johannes Schindelin | a97a746 | 2009-10-09 12:21:57 +0200 | [diff] [blame] | 395 | #define GIT_NOTES_REF_ENVIRONMENT "GIT_NOTES_REF" |
| 396 | #define GIT_NOTES_DEFAULT_REF "refs/notes/commits" |
Thomas Rast | 894a9d3 | 2010-03-12 18:04:26 +0100 | [diff] [blame] | 397 | #define GIT_NOTES_DISPLAY_REF_ENVIRONMENT "GIT_NOTES_DISPLAY_REF" |
Thomas Rast | 6956f85 | 2010-03-12 18:04:32 +0100 | [diff] [blame] | 398 | #define GIT_NOTES_REWRITE_REF_ENVIRONMENT "GIT_NOTES_REWRITE_REF" |
| 399 | #define GIT_NOTES_REWRITE_MODE_ENVIRONMENT "GIT_NOTES_REWRITE_MODE" |
Linus Torvalds | bb233d6 | 2005-04-21 10:55:18 -0700 | [diff] [blame] | 400 | |
Giuseppe Bilotta | 48a7c1c | 2010-02-25 00:34:14 +0100 | [diff] [blame] | 401 | /* |
| 402 | * Repository-local GIT_* environment variables |
| 403 | * The array is NULL-terminated to simplify its usage in contexts such |
| 404 | * environment creation or simple walk of the list. |
| 405 | * The number of non-NULL entries is available as a macro. |
| 406 | */ |
Jonathan Nieder | 655e8d9 | 2010-08-24 01:41:14 -0500 | [diff] [blame] | 407 | #define LOCAL_REPO_ENV_SIZE 9 |
Giuseppe Bilotta | 48a7c1c | 2010-02-25 00:34:14 +0100 | [diff] [blame] | 408 | extern const char *const local_repo_env[LOCAL_REPO_ENV_SIZE + 1]; |
| 409 | |
Junio C Hamano | 7d1864c | 2007-01-07 02:00:28 -0800 | [diff] [blame] | 410 | extern int is_bare_repository_cfg; |
| 411 | extern int is_bare_repository(void); |
Johannes Schindelin | 6802563 | 2007-01-20 03:09:34 +0100 | [diff] [blame] | 412 | extern int is_inside_git_dir(void); |
Johannes Schindelin | e90fdc3 | 2007-08-01 01:30:14 +0100 | [diff] [blame] | 413 | extern char *git_work_tree_cfg; |
Matthias Lederhofer | 892c41b | 2007-06-06 09:10:42 +0200 | [diff] [blame] | 414 | extern int is_inside_work_tree(void); |
Dmitry Potapov | d2b0708 | 2008-09-27 12:41:50 +0400 | [diff] [blame] | 415 | extern int have_git_dir(void); |
Pierre Habouzit | c5fba16 | 2006-08-23 12:39:11 +0200 | [diff] [blame] | 416 | extern const char *get_git_dir(void); |
Junio C Hamano | 8ac069a | 2005-05-09 22:57:58 -0700 | [diff] [blame] | 417 | extern char *get_object_directory(void); |
| 418 | extern char *get_index_file(void); |
Junio C Hamano | 5da5c8f | 2005-07-30 00:58:28 -0700 | [diff] [blame] | 419 | extern char *get_graft_file(void); |
Johannes Schindelin | d7ac12b | 2007-08-01 01:29:38 +0100 | [diff] [blame] | 420 | extern int set_git_dir(const char *path); |
Johannes Schindelin | e90fdc3 | 2007-08-01 01:30:14 +0100 | [diff] [blame] | 421 | extern const char *get_git_work_tree(void); |
Lars Hjemli | b44ebb1 | 2008-02-20 23:13:13 +0100 | [diff] [blame] | 422 | extern const char *read_gitfile_gently(const char *path); |
Daniel Barkalow | 19757d8 | 2008-04-27 13:39:21 -0400 | [diff] [blame] | 423 | extern void set_git_work_tree(const char *tree); |
Junio C Hamano | 8ac069a | 2005-05-09 22:57:58 -0700 | [diff] [blame] | 424 | |
| 425 | #define ALTERNATE_DB_ENVIRONMENT "GIT_ALTERNATE_OBJECT_DIRECTORIES" |
Linus Torvalds | bb233d6 | 2005-04-21 10:55:18 -0700 | [diff] [blame] | 426 | |
Junio C Hamano | 6b5ee13 | 2005-09-21 00:00:47 -0700 | [diff] [blame] | 427 | extern const char **get_pathspec(const char *prefix, const char **pathspec); |
Mike Hommey | 59f0f2f | 2007-11-03 12:23:11 +0100 | [diff] [blame] | 428 | extern void setup_work_tree(void); |
Junio C Hamano | 4ca0660 | 2005-11-25 23:14:15 -0800 | [diff] [blame] | 429 | extern const char *setup_git_directory_gently(int *); |
Linus Torvalds | d288a70 | 2005-08-16 18:06:34 -0700 | [diff] [blame] | 430 | extern const char *setup_git_directory(void); |
Junio C Hamano | 6b5ee13 | 2005-09-21 00:00:47 -0700 | [diff] [blame] | 431 | extern const char *prefix_path(const char *prefix, int len, const char *path); |
Junio C Hamano | 4ca0660 | 2005-11-25 23:14:15 -0800 | [diff] [blame] | 432 | extern const char *prefix_filename(const char *prefix, int len, const char *path); |
Junio C Hamano | c6e8c80 | 2009-10-18 00:27:24 -0700 | [diff] [blame] | 433 | extern int check_filename(const char *prefix, const char *name); |
Linus Torvalds | e23d0b4 | 2006-04-26 10:15:54 -0700 | [diff] [blame] | 434 | extern void verify_filename(const char *prefix, const char *name); |
Junio C Hamano | ea92f41 | 2006-04-26 15:09:27 -0700 | [diff] [blame] | 435 | extern void verify_non_filename(const char *prefix, const char *name); |
Linus Torvalds | d288a70 | 2005-08-16 18:06:34 -0700 | [diff] [blame] | 436 | |
Daniel Barkalow | f225aeb | 2008-04-27 13:39:27 -0400 | [diff] [blame] | 437 | #define INIT_DB_QUIET 0x0001 |
| 438 | |
| 439 | extern int init_db(const char *template_dir, unsigned int flags); |
| 440 | |
Linus Torvalds | e83c516 | 2005-04-07 15:13:13 -0700 | [diff] [blame] | 441 | #define alloc_nr(x) (((x)+16)*3/2) |
| 442 | |
Jeff King | 6815e56 | 2007-06-11 09:39:44 -0400 | [diff] [blame] | 443 | /* |
| 444 | * Realloc the buffer pointed at by variable 'x' so that it can hold |
| 445 | * at least 'nr' entries; the number of entries currently allocated |
| 446 | * is 'alloc', using the standard growing factor alloc_nr() macro. |
| 447 | * |
Jonathan Nieder | 01f6fd4 | 2010-10-08 11:46:59 -0500 | [diff] [blame] | 448 | * DO NOT USE any expression with side-effect for 'x', 'nr', or 'alloc'. |
Jeff King | 6815e56 | 2007-06-11 09:39:44 -0400 | [diff] [blame] | 449 | */ |
| 450 | #define ALLOC_GROW(x, nr, alloc) \ |
| 451 | do { \ |
Jeff King | c927e6c | 2007-06-16 18:37:39 -0400 | [diff] [blame] | 452 | if ((nr) > alloc) { \ |
Junio C Hamano | 4234a76 | 2007-06-11 22:10:55 -0700 | [diff] [blame] | 453 | if (alloc_nr(alloc) < (nr)) \ |
| 454 | alloc = (nr); \ |
| 455 | else \ |
| 456 | alloc = alloc_nr(alloc); \ |
Jeff King | 6815e56 | 2007-06-11 09:39:44 -0400 | [diff] [blame] | 457 | x = xrealloc((x), alloc * sizeof(*(x))); \ |
| 458 | } \ |
Jonathan Nieder | 9874606 | 2010-08-12 17:11:15 -0500 | [diff] [blame] | 459 | } while (0) |
Jeff King | 6815e56 | 2007-06-11 09:39:44 -0400 | [diff] [blame] | 460 | |
Linus Torvalds | 734aab7 | 2005-04-09 09:48:20 -0700 | [diff] [blame] | 461 | /* Initialize and use the cache information */ |
Junio C Hamano | 4aab5b4 | 2007-04-01 23:26:07 -0700 | [diff] [blame] | 462 | extern int read_index(struct index_state *); |
Linus Torvalds | 671c9b7 | 2008-11-13 16:36:30 -0800 | [diff] [blame] | 463 | extern int read_index_preload(struct index_state *, const char **pathspec); |
Junio C Hamano | 4aab5b4 | 2007-04-01 23:26:07 -0700 | [diff] [blame] | 464 | extern int read_index_from(struct index_state *, const char *path); |
Junio C Hamano | fa7b3c2 | 2008-11-12 11:52:35 -0800 | [diff] [blame] | 465 | extern int is_index_unborn(struct index_state *); |
Miklos Vajna | e46bbcf | 2008-06-27 18:21:58 +0200 | [diff] [blame] | 466 | extern int read_index_unmerged(struct index_state *); |
Kjetil Barvik | e1afca4 | 2009-02-23 19:02:57 +0100 | [diff] [blame] | 467 | extern int write_index(struct index_state *, int newfd); |
Junio C Hamano | 4aab5b4 | 2007-04-01 23:26:07 -0700 | [diff] [blame] | 468 | extern int discard_index(struct index_state *); |
Linus Torvalds | d1f128b | 2008-03-06 12:46:09 -0800 | [diff] [blame] | 469 | extern int unmerged_index(const struct index_state *); |
Linus Torvalds | 8dcf39c | 2006-05-18 12:07:31 -0700 | [diff] [blame] | 470 | extern int verify_path(const char *path); |
Linus Torvalds | cd2fef5 | 2008-03-21 15:55:19 -0700 | [diff] [blame] | 471 | extern struct cache_entry *index_name_exists(struct index_state *istate, const char *name, int namelen, int igncase); |
Linus Torvalds | d1f128b | 2008-03-06 12:46:09 -0800 | [diff] [blame] | 472 | extern int index_name_pos(const struct index_state *, const char *name, int namelen); |
Junio C Hamano | 192268c | 2005-05-07 21:55:21 -0700 | [diff] [blame] | 473 | #define ADD_CACHE_OK_TO_ADD 1 /* Ok to add */ |
| 474 | #define ADD_CACHE_OK_TO_REPLACE 2 /* Ok to replace file/directory */ |
Junio C Hamano | b155725 | 2005-06-25 02:25:29 -0700 | [diff] [blame] | 475 | #define ADD_CACHE_SKIP_DFCHECK 4 /* Ok to skip DF conflict checks */ |
Junio C Hamano | af3785d | 2007-08-09 13:42:50 -0700 | [diff] [blame] | 476 | #define ADD_CACHE_JUST_APPEND 8 /* Append only; tree.c::read_tree() */ |
Junio C Hamano | 3942581 | 2008-08-21 01:44:53 -0700 | [diff] [blame] | 477 | #define ADD_CACHE_NEW_ONLY 16 /* Do not replace existing ones */ |
Junio C Hamano | 4aab5b4 | 2007-04-01 23:26:07 -0700 | [diff] [blame] | 478 | extern int add_index_entry(struct index_state *, struct cache_entry *ce, int option); |
Petr Baudis | 81dc230 | 2008-07-21 02:25:56 +0200 | [diff] [blame] | 479 | extern void rename_index_entry_at(struct index_state *, int pos, const char *new_name); |
Junio C Hamano | 4aab5b4 | 2007-04-01 23:26:07 -0700 | [diff] [blame] | 480 | extern int remove_index_entry_at(struct index_state *, int pos); |
Kjetil Barvik | 36419c8 | 2009-02-18 23:18:03 +0100 | [diff] [blame] | 481 | extern void remove_marked_cache_entries(struct index_state *istate); |
Junio C Hamano | 4aab5b4 | 2007-04-01 23:26:07 -0700 | [diff] [blame] | 482 | extern int remove_file_from_index(struct index_state *, const char *path); |
Junio C Hamano | 38ed1d8 | 2008-05-21 12:04:34 -0700 | [diff] [blame] | 483 | #define ADD_CACHE_VERBOSE 1 |
| 484 | #define ADD_CACHE_PRETEND 2 |
Junio C Hamano | 0166592 | 2008-05-25 14:03:50 -0700 | [diff] [blame] | 485 | #define ADD_CACHE_IGNORE_ERRORS 4 |
Junio C Hamano | 041aee3 | 2008-07-21 01:24:17 -0700 | [diff] [blame] | 486 | #define ADD_CACHE_IGNORE_REMOVAL 8 |
Junio C Hamano | 3942581 | 2008-08-21 01:44:53 -0700 | [diff] [blame] | 487 | #define ADD_CACHE_INTENT 16 |
Junio C Hamano | 38ed1d8 | 2008-05-21 12:04:34 -0700 | [diff] [blame] | 488 | extern int add_to_index(struct index_state *, const char *path, struct stat *, int flags); |
| 489 | extern int add_file_to_index(struct index_state *, const char *path, int flags); |
Carlos Rica | 6640f88 | 2007-09-11 05:17:28 +0200 | [diff] [blame] | 490 | extern struct cache_entry *make_cache_entry(unsigned int mode, const unsigned char *sha1, const char *path, int stage, int refresh); |
Brad Roberts | dbbce55 | 2005-05-14 19:04:25 -0700 | [diff] [blame] | 491 | extern int ce_same_name(struct cache_entry *a, struct cache_entry *b); |
Jeff King | 98fa473 | 2008-10-16 11:07:26 -0400 | [diff] [blame] | 492 | extern int index_name_is_other(const struct index_state *, const char *, int); |
Junio C Hamano | 4bd5b7d | 2007-11-10 00:15:03 -0800 | [diff] [blame] | 493 | |
| 494 | /* do stat comparison even if CE_VALID is true */ |
| 495 | #define CE_MATCH_IGNORE_VALID 01 |
| 496 | /* do not check the contents but report dirty on racily-clean entries */ |
Nguyễn Thái Ngọc Duy | 56cac48 | 2009-12-14 18:43:58 +0700 | [diff] [blame] | 497 | #define CE_MATCH_RACY_IS_DIRTY 02 |
| 498 | /* do stat comparison even if CE_SKIP_WORKTREE is true */ |
| 499 | #define CE_MATCH_IGNORE_SKIP_WORKTREE 04 |
Linus Torvalds | d1f128b | 2008-03-06 12:46:09 -0800 | [diff] [blame] | 500 | extern int ie_match_stat(const struct index_state *, struct cache_entry *, struct stat *, unsigned int); |
| 501 | extern int ie_modified(const struct index_state *, struct cache_entry *, struct stat *, unsigned int); |
Junio C Hamano | 4bd5b7d | 2007-11-10 00:15:03 -0800 | [diff] [blame] | 502 | |
Linus Torvalds | c0fd1f5 | 2005-07-14 16:55:06 -0700 | [diff] [blame] | 503 | extern int ce_path_match(const struct cache_entry *ce, const char **pathspec); |
Junio C Hamano | 53bca91 | 2007-02-28 11:52:04 -0800 | [diff] [blame] | 504 | extern int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object, enum object_type type, const char *path); |
Junio C Hamano | ec1fcc1 | 2005-10-07 03:42:00 -0700 | [diff] [blame] | 505 | extern int index_path(unsigned char *sha1, const char *path, struct stat *st, int write_object); |
Junio C Hamano | 415e96c | 2005-05-15 14:23:12 -0700 | [diff] [blame] | 506 | extern void fill_stat_cache_info(struct cache_entry *ce, struct stat *st); |
| 507 | |
Linus Torvalds | 405e5b2 | 2006-05-19 09:56:35 -0700 | [diff] [blame] | 508 | #define REFRESH_REALLY 0x0001 /* ignore_valid */ |
| 509 | #define REFRESH_UNMERGED 0x0002 /* allow unmerged */ |
| 510 | #define REFRESH_QUIET 0x0004 /* be quiet about it */ |
| 511 | #define REFRESH_IGNORE_MISSING 0x0008 /* ignore non-existent */ |
Junio C Hamano | 3f1b7b6 | 2008-07-19 23:25:00 -0700 | [diff] [blame] | 512 | #define REFRESH_IGNORE_SUBMODULES 0x0010 /* ignore submodules */ |
Matthieu Moy | 43673fd | 2009-08-21 10:57:58 +0200 | [diff] [blame] | 513 | #define REFRESH_IN_PORCELAIN 0x0020 /* user friendly output, not "needs update" */ |
Matthieu Moy | 3deffc5 | 2009-08-21 10:57:59 +0200 | [diff] [blame] | 514 | extern int refresh_index(struct index_state *, unsigned int flags, const char **pathspec, char *seen, char *header_msg); |
Linus Torvalds | 405e5b2 | 2006-05-19 09:56:35 -0700 | [diff] [blame] | 515 | |
Junio C Hamano | 021b6e4 | 2006-06-06 12:51:49 -0700 | [diff] [blame] | 516 | struct lock_file { |
| 517 | struct lock_file *next; |
Johannes Schindelin | 4723ee9 | 2007-11-13 21:05:03 +0100 | [diff] [blame] | 518 | int fd; |
Junio C Hamano | 5e635e3 | 2007-04-21 03:11:10 -0700 | [diff] [blame] | 519 | pid_t owner; |
Junio C Hamano | 1084b84 | 2007-01-02 11:19:05 -0800 | [diff] [blame] | 520 | char on_list; |
Junio C Hamano | 021b6e4 | 2006-06-06 12:51:49 -0700 | [diff] [blame] | 521 | char filename[PATH_MAX]; |
Junio C Hamano | 415e96c | 2005-05-15 14:23:12 -0700 | [diff] [blame] | 522 | }; |
Junio C Hamano | acd3b9e | 2008-10-17 15:44:39 -0700 | [diff] [blame] | 523 | #define LOCK_DIE_ON_ERROR 1 |
| 524 | #define LOCK_NODEREF 2 |
Miklos Vajna | 1b018fd | 2009-09-27 01:15:09 +0200 | [diff] [blame] | 525 | extern int unable_to_lock_error(const char *path, int err); |
Matthieu Moy | e43a6fd | 2009-02-19 13:54:18 +0100 | [diff] [blame] | 526 | extern NORETURN void unable_to_lock_index_die(const char *path, int err); |
Junio C Hamano | 40aaae8 | 2006-08-12 01:03:47 -0700 | [diff] [blame] | 527 | extern int hold_lock_file_for_update(struct lock_file *, const char *path, int); |
Daniel Barkalow | ea3cd5c | 2008-04-17 19:32:26 -0400 | [diff] [blame] | 528 | extern int hold_lock_file_for_append(struct lock_file *, const char *path, int); |
Junio C Hamano | 021b6e4 | 2006-06-06 12:51:49 -0700 | [diff] [blame] | 529 | extern int commit_lock_file(struct lock_file *); |
Junio C Hamano | 30ca07a | 2007-03-31 23:09:02 -0700 | [diff] [blame] | 530 | |
| 531 | extern int hold_locked_index(struct lock_file *, int); |
| 532 | extern int commit_locked_index(struct lock_file *); |
Junio C Hamano | 5e7f56a | 2007-03-31 23:27:41 -0700 | [diff] [blame] | 533 | extern void set_alternate_index_output(const char *); |
Brandon Casey | d6cf61b | 2008-01-16 11:05:32 -0800 | [diff] [blame] | 534 | extern int close_lock_file(struct lock_file *); |
Junio C Hamano | 021b6e4 | 2006-06-06 12:51:49 -0700 | [diff] [blame] | 535 | extern void rollback_lock_file(struct lock_file *); |
Miklos Vajna | eca35a2 | 2008-10-26 03:33:56 +0100 | [diff] [blame] | 536 | extern int delete_ref(const char *, const unsigned char *sha1, int delopt); |
Linus Torvalds | 734aab7 | 2005-04-09 09:48:20 -0700 | [diff] [blame] | 537 | |
Junio C Hamano | 2ae1c53 | 2006-02-27 14:47:45 -0800 | [diff] [blame] | 538 | /* Environment bits from configuration mechanism */ |
Linus Torvalds | 1771299 | 2005-10-10 16:31:08 -0700 | [diff] [blame] | 539 | extern int trust_executable_bit; |
Alex Riesen | 1ce4790 | 2008-07-28 08:31:28 +0200 | [diff] [blame] | 540 | extern int trust_ctime; |
Junio C Hamano | 9378c16 | 2007-06-24 15:11:24 -0700 | [diff] [blame] | 541 | extern int quote_path_fully; |
Johannes Sixt | 78a8d64 | 2007-03-02 22:11:30 +0100 | [diff] [blame] | 542 | extern int has_symlinks; |
Linus Torvalds | 0a9b88b | 2008-03-21 16:52:46 -0700 | [diff] [blame] | 543 | extern int ignore_case; |
Junio C Hamano | 5f73076 | 2006-02-08 21:15:24 -0800 | [diff] [blame] | 544 | extern int assume_unchanged; |
Junio C Hamano | 9f0bb90 | 2006-05-02 00:40:24 -0700 | [diff] [blame] | 545 | extern int prefer_symlink_refs; |
Shawn Pearce | 6de08ae | 2006-05-17 05:55:40 -0400 | [diff] [blame] | 546 | extern int log_all_ref_updates; |
Junio C Hamano | 2f8acdb | 2006-03-20 18:45:47 -0800 | [diff] [blame] | 547 | extern int warn_ambiguous_refs; |
Junio C Hamano | 72a5b56 | 2010-10-28 14:39:13 -0700 | [diff] [blame] | 548 | extern int unique_abbrev_extra_length; |
Johannes Schindelin | 457f06d | 2005-12-22 23:13:56 +0100 | [diff] [blame] | 549 | extern int shared_repository; |
Junio C Hamano | 2ae1c53 | 2006-02-27 14:47:45 -0800 | [diff] [blame] | 550 | extern const char *apply_default_whitespace; |
Giuseppe Bilotta | 86c91f9 | 2009-08-04 13:16:49 +0200 | [diff] [blame] | 551 | extern const char *apply_default_ignorewhitespace; |
Joachim B Haga | 12f6c30 | 2006-07-03 22:11:47 +0200 | [diff] [blame] | 552 | extern int zlib_compression_level; |
Dana How | 960ccca | 2007-05-09 13:56:50 -0700 | [diff] [blame] | 553 | extern int core_compression_level; |
| 554 | extern int core_compression_seen; |
Shawn O. Pearce | 60bb8b1 | 2006-12-23 02:34:28 -0500 | [diff] [blame] | 555 | extern size_t packed_git_window_size; |
Shawn O. Pearce | 77ccc5b | 2006-12-23 02:33:35 -0500 | [diff] [blame] | 556 | extern size_t packed_git_limit; |
Shawn O. Pearce | 18bdec1 | 2007-03-19 01:14:37 -0400 | [diff] [blame] | 557 | extern size_t delta_base_cache_limit; |
Christian Couder | dae556b | 2009-01-23 10:07:46 +0100 | [diff] [blame] | 558 | extern int read_replace_refs; |
Linus Torvalds | aafe9fb | 2008-06-18 15:18:44 -0700 | [diff] [blame] | 559 | extern int fsync_object_files; |
Linus Torvalds | 671c9b7 | 2008-11-13 16:36:30 -0800 | [diff] [blame] | 560 | extern int core_preload_index; |
Nguyễn Thái Ngọc Duy | 08aefc9 | 2009-08-20 20:47:08 +0700 | [diff] [blame] | 561 | extern int core_apply_sparse_checkout; |
Linus Torvalds | 1771299 | 2005-10-10 16:31:08 -0700 | [diff] [blame] | 562 | |
Steffen Prohaska | 21e5ad5 | 2008-02-06 12:25:58 +0100 | [diff] [blame] | 563 | enum safe_crlf { |
| 564 | SAFE_CRLF_FALSE = 0, |
| 565 | SAFE_CRLF_FAIL = 1, |
Gary V. Vaughan | 4b05548 | 2010-05-14 09:31:35 +0000 | [diff] [blame] | 566 | SAFE_CRLF_WARN = 2 |
Steffen Prohaska | 21e5ad5 | 2008-02-06 12:25:58 +0100 | [diff] [blame] | 567 | }; |
| 568 | |
| 569 | extern enum safe_crlf safe_crlf; |
| 570 | |
Eyvind Bernhardsen | fd6cce9 | 2010-05-19 22:43:10 +0200 | [diff] [blame] | 571 | enum auto_crlf { |
| 572 | AUTO_CRLF_FALSE = 0, |
| 573 | AUTO_CRLF_TRUE = 1, |
| 574 | AUTO_CRLF_INPUT = -1, |
| 575 | }; |
| 576 | |
| 577 | extern enum auto_crlf auto_crlf; |
| 578 | |
Eyvind Bernhardsen | 942e774 | 2010-06-04 21:29:08 +0200 | [diff] [blame] | 579 | enum eol { |
| 580 | EOL_UNSET, |
| 581 | EOL_CRLF, |
| 582 | EOL_LF, |
| 583 | #ifdef NATIVE_CRLF |
| 584 | EOL_NATIVE = EOL_CRLF |
| 585 | #else |
| 586 | EOL_NATIVE = EOL_LF |
| 587 | #endif |
| 588 | }; |
| 589 | |
| 590 | extern enum eol eol; |
| 591 | |
Jay Soffian | 9ed36cf | 2008-02-19 11:24:37 -0500 | [diff] [blame] | 592 | enum branch_track { |
Alex Riesen | 9188ed8 | 2008-08-21 19:23:20 +0200 | [diff] [blame] | 593 | BRANCH_TRACK_UNSPECIFIED = -1, |
Jay Soffian | 9ed36cf | 2008-02-19 11:24:37 -0500 | [diff] [blame] | 594 | BRANCH_TRACK_NEVER = 0, |
| 595 | BRANCH_TRACK_REMOTE, |
| 596 | BRANCH_TRACK_ALWAYS, |
| 597 | BRANCH_TRACK_EXPLICIT, |
Gary V. Vaughan | 4b05548 | 2010-05-14 09:31:35 +0000 | [diff] [blame] | 598 | BRANCH_TRACK_OVERRIDE |
Jay Soffian | 9ed36cf | 2008-02-19 11:24:37 -0500 | [diff] [blame] | 599 | }; |
| 600 | |
Dustin Sallings | c998ae9 | 2008-05-10 15:36:29 -0700 | [diff] [blame] | 601 | enum rebase_setup_type { |
| 602 | AUTOREBASE_NEVER = 0, |
| 603 | AUTOREBASE_LOCAL, |
| 604 | AUTOREBASE_REMOTE, |
Gary V. Vaughan | 4b05548 | 2010-05-14 09:31:35 +0000 | [diff] [blame] | 605 | AUTOREBASE_ALWAYS |
Dustin Sallings | c998ae9 | 2008-05-10 15:36:29 -0700 | [diff] [blame] | 606 | }; |
| 607 | |
Finn Arne Gangstad | 5215374 | 2009-03-16 16:42:51 +0100 | [diff] [blame] | 608 | enum push_default_type { |
Finn Arne Gangstad | 5215374 | 2009-03-16 16:42:51 +0100 | [diff] [blame] | 609 | PUSH_DEFAULT_NOTHING = 0, |
| 610 | PUSH_DEFAULT_MATCHING, |
| 611 | PUSH_DEFAULT_TRACKING, |
Gary V. Vaughan | 4b05548 | 2010-05-14 09:31:35 +0000 | [diff] [blame] | 612 | PUSH_DEFAULT_CURRENT |
Finn Arne Gangstad | 5215374 | 2009-03-16 16:42:51 +0100 | [diff] [blame] | 613 | }; |
| 614 | |
Jay Soffian | 9ed36cf | 2008-02-19 11:24:37 -0500 | [diff] [blame] | 615 | extern enum branch_track git_branch_track; |
Dustin Sallings | c998ae9 | 2008-05-10 15:36:29 -0700 | [diff] [blame] | 616 | extern enum rebase_setup_type autorebase; |
Finn Arne Gangstad | 5215374 | 2009-03-16 16:42:51 +0100 | [diff] [blame] | 617 | extern enum push_default_type push_default; |
Jay Soffian | 9ed36cf | 2008-02-19 11:24:37 -0500 | [diff] [blame] | 618 | |
Johannes Schindelin | 348df16 | 2009-04-28 00:32:25 +0200 | [diff] [blame] | 619 | enum object_creation_mode { |
| 620 | OBJECT_CREATION_USES_HARDLINKS = 0, |
Gary V. Vaughan | 4b05548 | 2010-05-14 09:31:35 +0000 | [diff] [blame] | 621 | OBJECT_CREATION_USES_RENAMES = 1 |
Johannes Schindelin | 348df16 | 2009-04-28 00:32:25 +0200 | [diff] [blame] | 622 | }; |
| 623 | |
| 624 | extern enum object_creation_mode object_creation_mode; |
Johannes Schindelin | be66a6c | 2009-04-25 11:57:14 +0200 | [diff] [blame] | 625 | |
Johannes Schindelin | a97a746 | 2009-10-09 12:21:57 +0200 | [diff] [blame] | 626 | extern char *notes_ref_name; |
| 627 | |
Johannes Schindelin | 7f3140c | 2009-07-23 17:33:49 +0200 | [diff] [blame] | 628 | extern int grafts_replace_parents; |
| 629 | |
Junio C Hamano | ab9cb76 | 2005-11-25 15:59:09 -0800 | [diff] [blame] | 630 | #define GIT_REPO_VERSION 0 |
| 631 | extern int repository_format_version; |
| 632 | extern int check_repository_format(void); |
| 633 | |
Linus Torvalds | 734aab7 | 2005-04-09 09:48:20 -0700 | [diff] [blame] | 634 | #define MTIME_CHANGED 0x0001 |
| 635 | #define CTIME_CHANGED 0x0002 |
| 636 | #define OWNER_CHANGED 0x0004 |
| 637 | #define MODE_CHANGED 0x0008 |
| 638 | #define INODE_CHANGED 0x0010 |
| 639 | #define DATA_CHANGED 0x0020 |
Kay Sievers | 8ae0a8c | 2005-05-05 14:38:25 +0200 | [diff] [blame] | 640 | #define TYPE_CHANGED 0x0040 |
Linus Torvalds | e83c516 | 2005-04-07 15:13:13 -0700 | [diff] [blame] | 641 | |
Alex Riesen | 108bebe | 2008-10-26 22:59:13 +0100 | [diff] [blame] | 642 | extern char *mksnpath(char *buf, size_t n, const char *fmt, ...) |
| 643 | __attribute__((format (printf, 3, 4))); |
Alex Riesen | fe2d777 | 2008-10-27 10:22:21 +0100 | [diff] [blame] | 644 | extern char *git_snpath(char *buf, size_t n, const char *fmt, ...) |
| 645 | __attribute__((format (printf, 3, 4))); |
Alex Riesen | aba13e7 | 2008-10-27 11:17:51 +0100 | [diff] [blame] | 646 | extern char *git_pathdup(const char *fmt, ...) |
| 647 | __attribute__((format (printf, 1, 2))); |
Alex Riesen | 108bebe | 2008-10-26 22:59:13 +0100 | [diff] [blame] | 648 | |
Linus Torvalds | e83c516 | 2005-04-07 15:13:13 -0700 | [diff] [blame] | 649 | /* Return a statically allocated filename matching the sha1 signature */ |
Timo Sirainen | 4ec99bf | 2005-08-09 18:30:22 +0300 | [diff] [blame] | 650 | extern char *mkpath(const char *fmt, ...) __attribute__((format (printf, 1, 2))); |
| 651 | extern char *git_path(const char *fmt, ...) __attribute__((format (printf, 1, 2))); |
Heiko Voigt | 0bad611 | 2010-07-07 15:39:11 +0200 | [diff] [blame] | 652 | extern char *git_path_submodule(const char *path, const char *fmt, ...) |
| 653 | __attribute__((format (printf, 2, 3))); |
| 654 | |
Linus Torvalds | 73134b6 | 2005-04-10 14:03:58 -0700 | [diff] [blame] | 655 | extern char *sha1_file_name(const unsigned char *sha1); |
barkalow@iabervon.org | bf592c5 | 2005-07-31 20:53:44 -0400 | [diff] [blame] | 656 | extern char *sha1_pack_name(const unsigned char *sha1); |
| 657 | extern char *sha1_pack_index_name(const unsigned char *sha1); |
Junio C Hamano | 013f276 | 2005-10-11 15:22:48 -0700 | [diff] [blame] | 658 | extern const char *find_unique_abbrev(const unsigned char *sha1, int); |
Junio C Hamano | 88cd621 | 2005-09-30 14:02:47 -0700 | [diff] [blame] | 659 | extern const unsigned char null_sha1[20]; |
David Rientjes | 0bef57e | 2006-08-15 13:37:19 -0700 | [diff] [blame] | 660 | static inline int is_null_sha1(const unsigned char *sha1) |
| 661 | { |
| 662 | return !memcmp(sha1, null_sha1, 20); |
| 663 | } |
David Rientjes | a89fccd | 2006-08-17 11:54:57 -0700 | [diff] [blame] | 664 | static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2) |
| 665 | { |
| 666 | return memcmp(sha1, sha2, 20); |
| 667 | } |
Shawn Pearce | e702496 | 2006-08-23 02:49:00 -0400 | [diff] [blame] | 668 | static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src) |
| 669 | { |
| 670 | memcpy(sha_dst, sha_src, 20); |
| 671 | } |
Junio C Hamano | a8e0d16 | 2006-08-23 13:57:23 -0700 | [diff] [blame] | 672 | static inline void hashclr(unsigned char *hash) |
| 673 | { |
| 674 | memset(hash, 0, 20); |
| 675 | } |
Linus Torvalds | e83c516 | 2005-04-07 15:13:13 -0700 | [diff] [blame] | 676 | |
Jeff King | 14d9c57 | 2008-11-12 03:17:52 -0500 | [diff] [blame] | 677 | #define EMPTY_TREE_SHA1_HEX \ |
| 678 | "4b825dc642cb6eb9a060e54bf8d69288fbee4904" |
| 679 | #define EMPTY_TREE_SHA1_BIN \ |
| 680 | "\x4b\x82\x5d\xc6\x42\xcb\x6e\xb9\xa0\x60" \ |
| 681 | "\xe5\x4b\xf8\xd6\x92\x88\xfb\xee\x49\x04" |
| 682 | |
Holger Eitzenberger | f2db68e | 2005-08-04 22:43:03 +0200 | [diff] [blame] | 683 | int git_mkstemp(char *path, size_t n, const char *template); |
| 684 | |
David Aguilar | 003b33a | 2009-05-31 01:35:52 -0700 | [diff] [blame] | 685 | int git_mkstemps(char *path, size_t n, const char *template, int suffix_len); |
| 686 | |
Matthieu Moy | b862b61 | 2010-02-22 23:32:13 +0100 | [diff] [blame] | 687 | /* set default permissions by passing mode arguments to open(2) */ |
| 688 | int git_mkstemps_mode(char *pattern, int suffix_len, int mode); |
| 689 | int git_mkstemp_mode(char *pattern, int mode); |
| 690 | |
Heikki Orsila | 06cbe85 | 2008-04-16 11:34:24 +0300 | [diff] [blame] | 691 | /* |
| 692 | * NOTE NOTE NOTE!! |
| 693 | * |
| 694 | * PERM_UMASK, OLD_PERM_GROUP and OLD_PERM_EVERYBODY enumerations must |
| 695 | * not be changed. Old repositories have core.sharedrepository written in |
| 696 | * numeric format, and therefore these values are preserved for compatibility |
| 697 | * reasons. |
| 698 | */ |
Junio C Hamano | 94df250 | 2006-06-09 23:09:49 -0700 | [diff] [blame] | 699 | enum sharedrepo { |
Heikki Orsila | 06cbe85 | 2008-04-16 11:34:24 +0300 | [diff] [blame] | 700 | PERM_UMASK = 0, |
| 701 | OLD_PERM_GROUP = 1, |
| 702 | OLD_PERM_EVERYBODY = 2, |
| 703 | PERM_GROUP = 0660, |
Gary V. Vaughan | 4b05548 | 2010-05-14 09:31:35 +0000 | [diff] [blame] | 704 | PERM_EVERYBODY = 0664 |
Junio C Hamano | 94df250 | 2006-06-09 23:09:49 -0700 | [diff] [blame] | 705 | }; |
| 706 | int git_config_perm(const char *var, const char *value); |
Junio C Hamano | 17e61b8 | 2009-03-27 23:21:00 -0700 | [diff] [blame] | 707 | int set_shared_perm(const char *path, int mode); |
| 708 | #define adjust_shared_perm(path) set_shared_perm((path), 0) |
Junio C Hamano | b2cb942 | 2005-07-06 01:11:52 -0700 | [diff] [blame] | 709 | int safe_create_leading_directories(char *path); |
Jeff King | 8e21d63 | 2008-06-25 01:41:34 -0400 | [diff] [blame] | 710 | int safe_create_leading_directories_const(const char *path); |
Matthieu Moy | 395de25 | 2009-11-17 18:24:25 +0100 | [diff] [blame] | 711 | extern char *expand_user_path(const char *path); |
Timo Hirvonen | bd22c90 | 2005-11-21 02:52:52 +0200 | [diff] [blame] | 712 | char *enter_repo(char *path, int strict); |
Johannes Schindelin | e5392c5 | 2007-08-01 01:28:59 +0100 | [diff] [blame] | 713 | static inline int is_absolute_path(const char *path) |
| 714 | { |
Johannes Sixt | 25fe217 | 2008-03-05 21:51:27 +0100 | [diff] [blame] | 715 | return path[0] == '/' || has_dos_drive_prefix(path); |
Johannes Schindelin | e5392c5 | 2007-08-01 01:28:59 +0100 | [diff] [blame] | 716 | } |
Junio C Hamano | 90b4a71 | 2008-09-09 01:27:07 -0700 | [diff] [blame] | 717 | int is_directory(const char *); |
Johannes Schindelin | e5392c5 | 2007-08-01 01:28:59 +0100 | [diff] [blame] | 718 | const char *make_absolute_path(const char *path); |
Daniel Barkalow | 1b9a946 | 2008-06-05 23:15:19 -0400 | [diff] [blame] | 719 | const char *make_nonrelative_path(const char *path); |
Linus Torvalds | 044bbbc | 2008-06-19 12:34:06 -0700 | [diff] [blame] | 720 | const char *make_relative_path(const char *abs, const char *base); |
Johannes Sixt | f3cad0a | 2009-02-07 16:08:28 +0100 | [diff] [blame] | 721 | int normalize_path_copy(char *dst, const char *src); |
David Reiss | 0454dd9 | 2008-05-19 23:49:26 -0700 | [diff] [blame] | 722 | int longest_ancestor_length(const char *path, const char *prefix_list); |
Johannes Schindelin | 4fcc86b | 2009-02-19 20:10:49 +0100 | [diff] [blame] | 723 | char *strip_path_suffix(const char *path, const char *suffix); |
Shawn O. Pearce | 34b6cb8 | 2009-11-09 11:26:43 -0800 | [diff] [blame] | 724 | int daemon_avoid_alias(const char *path); |
Nguyễn Thái Ngọc Duy | 4bb43de | 2010-02-16 12:22:08 +0700 | [diff] [blame] | 725 | int offset_1st_component(const char *path); |
Junio C Hamano | b2cb942 | 2005-07-06 01:11:52 -0700 | [diff] [blame] | 726 | |
Linus Torvalds | e83c516 | 2005-04-07 15:13:13 -0700 | [diff] [blame] | 727 | /* Read and unpack a sha1 file into memory, write memory to a sha1 file */ |
Nicolas Pitre | 21666f1 | 2007-02-26 14:55:59 -0500 | [diff] [blame] | 728 | extern int sha1_object_info(const unsigned char *, unsigned long *); |
Christian Couder | f5552ae | 2009-01-23 10:07:01 +0100 | [diff] [blame] | 729 | extern void *read_sha1_file_repl(const unsigned char *sha1, enum object_type *type, unsigned long *size, const unsigned char **replacement); |
| 730 | static inline void *read_sha1_file(const unsigned char *sha1, enum object_type *type, unsigned long *size) |
| 731 | { |
| 732 | return read_sha1_file_repl(sha1, type, size, NULL); |
| 733 | } |
Nicolas Pitre | ce9fbf1 | 2007-03-20 16:02:09 -0400 | [diff] [blame] | 734 | extern int hash_sha1_file(const void *buf, unsigned long len, const char *type, unsigned char *sha1); |
Jeff King | c00e657 | 2010-04-01 20:03:18 -0400 | [diff] [blame] | 735 | extern int write_sha1_file(const void *buf, unsigned long len, const char *type, unsigned char *return_sha1); |
Nicolas Pitre | 21666f1 | 2007-02-26 14:55:59 -0500 | [diff] [blame] | 736 | extern int pretend_sha1_file(void *, unsigned long, enum object_type, unsigned char *); |
Nicolas Pitre | bbac731 | 2008-05-14 01:32:48 -0400 | [diff] [blame] | 737 | extern int force_object_loose(const unsigned char *sha1, time_t mtime); |
Daniel Barkalow | 8237b18 | 2005-04-23 18:47:23 -0700 | [diff] [blame] | 738 | |
Nicolas Pitre | 0e8189e | 2008-10-31 11:31:08 -0400 | [diff] [blame] | 739 | /* global flag to enable extra checks when accessing packed objects */ |
| 740 | extern int do_check_packed_object_crc; |
| 741 | |
Jason McMullan | 5d6ccf5 | 2005-06-03 11:05:39 -0400 | [diff] [blame] | 742 | extern int check_sha1_signature(const unsigned char *sha1, void *buf, unsigned long size, const char *type); |
Linus Torvalds | e83c516 | 2005-04-07 15:13:13 -0700 | [diff] [blame] | 743 | |
Junio C Hamano | 839837b | 2006-09-01 00:17:47 -0700 | [diff] [blame] | 744 | extern int move_temp_to_file(const char *tmpfile, const char *filename); |
Daniel Barkalow | 8237b18 | 2005-04-23 18:47:23 -0700 | [diff] [blame] | 745 | |
Junio C Hamano | cd673c1 | 2009-02-27 23:15:53 -0800 | [diff] [blame] | 746 | extern int has_sha1_pack(const unsigned char *sha1); |
Daniel Barkalow | 8237b18 | 2005-04-23 18:47:23 -0700 | [diff] [blame] | 747 | extern int has_sha1_file(const unsigned char *sha1); |
Brandon Casey | 0f4dc14 | 2008-11-09 23:59:57 -0600 | [diff] [blame] | 748 | extern int has_loose_object_nonlocal(const unsigned char *sha1); |
Daniel Barkalow | 8237b18 | 2005-04-23 18:47:23 -0700 | [diff] [blame] | 749 | |
barkalow@iabervon.org | bf592c5 | 2005-07-31 20:53:44 -0400 | [diff] [blame] | 750 | extern int has_pack_index(const unsigned char *sha1); |
| 751 | |
Jeff King | 40d52ff | 2010-04-01 20:05:23 -0400 | [diff] [blame] | 752 | extern void assert_sha1_type(const unsigned char *sha1, enum object_type expect); |
| 753 | |
Linus Torvalds | 192a6be | 2007-05-30 10:32:19 -0700 | [diff] [blame] | 754 | extern const signed char hexval_table[256]; |
| 755 | static inline unsigned int hexval(unsigned char c) |
Junio C Hamano | e49521b | 2006-09-20 16:04:46 -0700 | [diff] [blame] | 756 | { |
| 757 | return hexval_table[c]; |
| 758 | } |
| 759 | |
Linus Torvalds | e83c516 | 2005-04-07 15:13:13 -0700 | [diff] [blame] | 760 | /* Convert to/from hex/sha1 representation */ |
Junio C Hamano | 46a6c26 | 2006-01-25 01:03:18 -0800 | [diff] [blame] | 761 | #define MINIMUM_ABBREV 4 |
| 762 | #define DEFAULT_ABBREV 7 |
| 763 | |
Clément Poulain | 573285e | 2010-06-09 19:02:06 +0200 | [diff] [blame] | 764 | struct object_context { |
| 765 | unsigned char tree[20]; |
| 766 | char path[PATH_MAX]; |
| 767 | unsigned mode; |
| 768 | }; |
| 769 | |
Linus Torvalds | 3c249c9 | 2005-05-01 16:36:56 -0700 | [diff] [blame] | 770 | extern int get_sha1(const char *str, unsigned char *sha1); |
Matthieu Moy | 009fee4 | 2009-12-07 11:10:50 +0100 | [diff] [blame] | 771 | extern int get_sha1_with_mode_1(const char *str, unsigned char *sha1, unsigned *mode, int gently, const char *prefix); |
| 772 | static inline int get_sha1_with_mode(const char *str, unsigned char *sha1, unsigned *mode) |
| 773 | { |
| 774 | return get_sha1_with_mode_1(str, sha1, mode, 1, NULL); |
| 775 | } |
Clément Poulain | 573285e | 2010-06-09 19:02:06 +0200 | [diff] [blame] | 776 | extern int get_sha1_with_context_1(const char *name, unsigned char *sha1, struct object_context *orc, int gently, const char *prefix); |
| 777 | static inline int get_sha1_with_context(const char *str, unsigned char *sha1, struct object_context *orc) |
| 778 | { |
| 779 | return get_sha1_with_context_1(str, sha1, orc, 1, NULL); |
| 780 | } |
Linus Torvalds | 197ee8c | 2005-04-09 12:09:27 -0700 | [diff] [blame] | 781 | extern int get_sha1_hex(const char *hex, unsigned char *sha1); |
| 782 | extern char *sha1_to_hex(const unsigned char *sha1); /* static buffer result! */ |
Linus Torvalds | ca8db14 | 2005-09-25 09:59:37 -0700 | [diff] [blame] | 783 | extern int read_ref(const char *filename, unsigned char *sha1); |
Junio C Hamano | 8da1977 | 2006-09-20 22:02:01 -0700 | [diff] [blame] | 784 | extern const char *resolve_ref(const char *path, unsigned char *sha1, int, int *); |
Junio C Hamano | e86eb66 | 2007-01-19 01:15:15 -0800 | [diff] [blame] | 785 | extern int dwim_ref(const char *str, int len, unsigned char *sha1, char **ref); |
Johannes Schindelin | eb3a482 | 2007-02-09 01:28:23 +0100 | [diff] [blame] | 786 | extern int dwim_log(const char *str, int len, unsigned char *sha1, char **ref); |
Junio C Hamano | 431b196 | 2009-03-21 12:51:34 -0700 | [diff] [blame] | 787 | extern int interpret_branch_name(const char *str, struct strbuf *); |
Junio C Hamano | 619a644 | 2009-10-18 12:34:56 -0700 | [diff] [blame] | 788 | extern int get_sha1_mb(const char *str, unsigned char *sha1); |
Junio C Hamano | e86eb66 | 2007-01-19 01:15:15 -0800 | [diff] [blame] | 789 | |
Steffen Prohaska | 7980332 | 2007-11-11 15:01:46 +0100 | [diff] [blame] | 790 | extern int refname_match(const char *abbrev_name, const char *full_name, const char **rules); |
| 791 | extern const char *ref_rev_parse_rules[]; |
Steffen Prohaska | 605b497 | 2007-11-11 15:01:48 +0100 | [diff] [blame] | 792 | extern const char *ref_fetch_rules[]; |
Steffen Prohaska | 7980332 | 2007-11-11 15:01:46 +0100 | [diff] [blame] | 793 | |
Nicolas Pitre | 8b5157e | 2007-01-26 17:26:10 -0500 | [diff] [blame] | 794 | extern int create_symref(const char *ref, const char *refs_heads_master, const char *logmsg); |
Junio C Hamano | c847f53 | 2007-01-01 23:31:08 -0800 | [diff] [blame] | 795 | extern int validate_headref(const char *ref); |
Linus Torvalds | e83c516 | 2005-04-07 15:13:13 -0700 | [diff] [blame] | 796 | |
Linus Torvalds | 958ba6c | 2005-05-20 09:09:18 -0700 | [diff] [blame] | 797 | extern int base_name_compare(const char *name1, int len1, int mode1, const char *name2, int len2, int mode2); |
Linus Torvalds | 0ab9e1e | 2008-03-05 18:25:10 -0800 | [diff] [blame] | 798 | extern int df_name_compare(const char *name1, int len1, int mode1, const char *name2, int len2, int mode2); |
Linus Torvalds | 79517a0 | 2005-04-09 12:59:11 -0700 | [diff] [blame] | 799 | extern int cache_name_compare(const char *name1, int len1, const char *name2, int len2); |
Linus Torvalds | e83c516 | 2005-04-07 15:13:13 -0700 | [diff] [blame] | 800 | |
Junio C Hamano | 40469ee | 2005-04-28 16:42:27 -0700 | [diff] [blame] | 801 | extern void *read_object_with_reference(const unsigned char *sha1, |
Brian Gerst | bf0f910 | 2005-05-18 08:14:09 -0400 | [diff] [blame] | 802 | const char *required_type, |
Junio C Hamano | 40469ee | 2005-04-28 16:42:27 -0700 | [diff] [blame] | 803 | unsigned long *size, |
| 804 | unsigned char *sha1_ret); |
Junio C Hamano | f4913f9 | 2005-04-20 18:06:49 -0700 | [diff] [blame] | 805 | |
Junio C Hamano | 8177631 | 2007-12-24 00:51:01 -0800 | [diff] [blame] | 806 | extern struct object *peel_to_type(const char *name, int namelen, |
| 807 | struct object *o, enum object_type); |
| 808 | |
Junio C Hamano | 73013af | 2007-07-13 23:14:52 -0700 | [diff] [blame] | 809 | enum date_mode { |
| 810 | DATE_NORMAL = 0, |
| 811 | DATE_RELATIVE, |
| 812 | DATE_SHORT, |
| 813 | DATE_LOCAL, |
| 814 | DATE_ISO8601, |
Linus Torvalds | 7dff9b3 | 2009-02-20 14:15:22 -0800 | [diff] [blame] | 815 | DATE_RFC2822, |
| 816 | DATE_RAW |
Junio C Hamano | 73013af | 2007-07-13 23:14:52 -0700 | [diff] [blame] | 817 | }; |
| 818 | |
Johannes Schindelin | f8493ec | 2007-02-27 16:21:04 +0100 | [diff] [blame] | 819 | const char *show_date(unsigned long time, int timezone, enum date_mode mode); |
Alex Riesen | 33012fc | 2009-08-30 22:26:05 -0400 | [diff] [blame] | 820 | const char *show_date_relative(unsigned long time, int tz, |
| 821 | const struct timeval *now, |
| 822 | char *timebuf, |
| 823 | size_t timebuf_size); |
Linus Torvalds | 2a39064 | 2005-09-19 15:53:50 -0700 | [diff] [blame] | 824 | int parse_date(const char *date, char *buf, int bufsize); |
Jonathan Nieder | 9644c06 | 2010-07-15 18:22:57 +0200 | [diff] [blame] | 825 | int parse_date_basic(const char *date, unsigned long *timestamp, int *offset); |
Edgar Toernig | ecee9d9 | 2005-04-30 09:46:49 -0700 | [diff] [blame] | 826 | void datestamp(char *buf, int bufsize); |
Junio C Hamano | 93cfa7c | 2010-01-26 11:58:00 -0800 | [diff] [blame] | 827 | #define approxidate(s) approxidate_careful((s), NULL) |
| 828 | unsigned long approxidate_careful(const char *, int *); |
Alex Riesen | 33012fc | 2009-08-30 22:26:05 -0400 | [diff] [blame] | 829 | unsigned long approxidate_relative(const char *date, const struct timeval *now); |
Andy Parkins | 856665f | 2007-09-28 15:17:31 +0100 | [diff] [blame] | 830 | enum date_mode parse_date_format(const char *format); |
Edgar Toernig | ecee9d9 | 2005-04-30 09:46:49 -0700 | [diff] [blame] | 831 | |
Junio C Hamano | 774751a | 2007-12-08 17:32:08 -0800 | [diff] [blame] | 832 | #define IDENT_WARN_ON_NO_NAME 1 |
| 833 | #define IDENT_ERROR_ON_NO_NAME 2 |
| 834 | #define IDENT_NO_DATE 4 |
Junio C Hamano | 749be72 | 2006-02-18 20:31:05 -0800 | [diff] [blame] | 835 | extern const char *git_author_info(int); |
| 836 | extern const char *git_committer_info(int); |
Junio C Hamano | 798123a | 2007-02-04 17:50:14 -0800 | [diff] [blame] | 837 | extern const char *fmt_ident(const char *name, const char *email, const char *date_str, int); |
Junio C Hamano | d9ccfe7 | 2007-12-02 13:43:34 -0800 | [diff] [blame] | 838 | extern const char *fmt_name(const char *name, const char *email); |
Jonathan Nieder | 44fcb49 | 2009-11-11 18:01:27 -0600 | [diff] [blame] | 839 | extern const char *git_editor(void); |
Jonathan Nieder | 64778d2 | 2010-02-14 05:59:59 -0600 | [diff] [blame] | 840 | extern const char *git_pager(int stdout_is_tty); |
Linus Torvalds | 6aa33f4 | 2005-07-12 11:49:27 -0700 | [diff] [blame] | 841 | |
Linus Torvalds | 12dccc1 | 2005-06-05 21:59:54 -0700 | [diff] [blame] | 842 | struct checkout { |
| 843 | const char *base_dir; |
| 844 | int base_dir_len; |
| 845 | unsigned force:1, |
| 846 | quiet:1, |
| 847 | not_new:1, |
| 848 | refresh_cache:1; |
| 849 | }; |
| 850 | |
Luiz Fernando N. Capitulino | efbc583 | 2007-04-25 11:18:08 -0300 | [diff] [blame] | 851 | extern int checkout_entry(struct cache_entry *ce, const struct checkout *state, char *topath); |
Linus Torvalds | b9fd284 | 2009-07-09 13:35:31 -0700 | [diff] [blame] | 852 | |
| 853 | struct cache_def { |
| 854 | char path[PATH_MAX + 1]; |
| 855 | int len; |
| 856 | int flags; |
| 857 | int track_flags; |
| 858 | int prefix_len_stat_func; |
| 859 | }; |
| 860 | |
Kjetil Barvik | 5719989 | 2009-02-09 21:54:06 +0100 | [diff] [blame] | 861 | extern int has_symlink_leading_path(const char *name, int len); |
Linus Torvalds | b9fd284 | 2009-07-09 13:35:31 -0700 | [diff] [blame] | 862 | extern int threaded_has_symlink_leading_path(struct cache_def *, const char *, int); |
Clemens Buchacher | f66caaf | 2010-10-09 15:53:00 +0200 | [diff] [blame] | 863 | extern int check_leading_path(const char *name, int len); |
Kjetil Barvik | 5719989 | 2009-02-09 21:54:06 +0100 | [diff] [blame] | 864 | extern int has_dirs_only_path(const char *name, int len, int prefix_len); |
Kjetil Barvik | 7847892 | 2009-02-09 21:54:07 +0100 | [diff] [blame] | 865 | extern void schedule_dir_for_removal(const char *name, int len); |
| 866 | extern void remove_scheduled_dirs(void); |
Linus Torvalds | 12dccc1 | 2005-06-05 21:59:54 -0700 | [diff] [blame] | 867 | |
Junio C Hamano | 9a217f2 | 2005-06-28 14:56:57 -0700 | [diff] [blame] | 868 | extern struct alternate_object_database { |
Junio C Hamano | d5a63b9 | 2005-08-14 17:25:57 -0700 | [diff] [blame] | 869 | struct alternate_object_database *next; |
Junio C Hamano | 9a217f2 | 2005-06-28 14:56:57 -0700 | [diff] [blame] | 870 | char *name; |
Junio C Hamano | 8f1d2e6 | 2006-01-07 01:33:54 -0800 | [diff] [blame] | 871 | char base[FLEX_ARRAY]; /* more */ |
Junio C Hamano | d5a63b9 | 2005-08-14 17:25:57 -0700 | [diff] [blame] | 872 | } *alt_odb_list; |
Junio C Hamano | 9a217f2 | 2005-06-28 14:56:57 -0700 | [diff] [blame] | 873 | extern void prepare_alt_odb(void); |
Daniel Barkalow | bef70b2 | 2008-04-17 19:32:30 -0400 | [diff] [blame] | 874 | extern void add_to_alternates_file(const char *reference); |
Junio C Hamano | d79796b | 2008-09-09 01:27:10 -0700 | [diff] [blame] | 875 | typedef int alt_odb_fn(struct alternate_object_database *, void *); |
| 876 | extern void foreach_alt_odb(alt_odb_fn, void*); |
Junio C Hamano | 9a217f2 | 2005-06-28 14:56:57 -0700 | [diff] [blame] | 877 | |
Shawn O. Pearce | c41ee58 | 2006-12-23 02:33:44 -0500 | [diff] [blame] | 878 | struct pack_window { |
| 879 | struct pack_window *next; |
| 880 | unsigned char *base; |
| 881 | off_t offset; |
| 882 | size_t len; |
| 883 | unsigned int last_used; |
| 884 | unsigned int inuse_cnt; |
| 885 | }; |
| 886 | |
Junio C Hamano | 9a217f2 | 2005-06-28 14:56:57 -0700 | [diff] [blame] | 887 | extern struct packed_git { |
| 888 | struct packed_git *next; |
Shawn O. Pearce | c41ee58 | 2006-12-23 02:33:44 -0500 | [diff] [blame] | 889 | struct pack_window *windows; |
Shawn O. Pearce | 2dc3a23 | 2006-12-23 02:33:47 -0500 | [diff] [blame] | 890 | off_t pack_size; |
Nicolas Pitre | 5705909 | 2007-04-09 01:06:28 -0400 | [diff] [blame] | 891 | const void *index_data; |
| 892 | size_t index_size; |
| 893 | uint32_t num_objects; |
Nicolas Pitre | 8eca0b4 | 2008-06-23 21:23:39 -0400 | [diff] [blame] | 894 | uint32_t num_bad_objects; |
| 895 | unsigned char *bad_object_sha1; |
Nicolas Pitre | 4287307 | 2007-03-16 16:42:50 -0400 | [diff] [blame] | 896 | int index_version; |
Nicolas Pitre | 5705909 | 2007-04-09 01:06:28 -0400 | [diff] [blame] | 897 | time_t mtime; |
Shawn O. Pearce | 9bc879c | 2006-12-23 02:34:01 -0500 | [diff] [blame] | 898 | int pack_fd; |
Brandon Casey | 8d25931 | 2008-11-12 11:59:03 -0600 | [diff] [blame] | 899 | unsigned pack_local:1, |
| 900 | pack_keep:1; |
barkalow@iabervon.org | bf592c5 | 2005-07-31 20:53:44 -0400 | [diff] [blame] | 901 | unsigned char sha1[20]; |
Junio C Hamano | 8f1d2e6 | 2006-01-07 01:33:54 -0800 | [diff] [blame] | 902 | /* something like ".git/objects/pack/xxxxx.pack" */ |
| 903 | char pack_name[FLEX_ARRAY]; /* more */ |
Junio C Hamano | 9a217f2 | 2005-06-28 14:56:57 -0700 | [diff] [blame] | 904 | } *packed_git; |
Junio C Hamano | f3bf922 | 2005-06-30 17:15:39 -0700 | [diff] [blame] | 905 | |
| 906 | struct pack_entry { |
Shawn O. Pearce | c4001d9 | 2007-03-06 20:44:30 -0500 | [diff] [blame] | 907 | off_t offset; |
Junio C Hamano | f3bf922 | 2005-06-30 17:15:39 -0700 | [diff] [blame] | 908 | unsigned char sha1[20]; |
| 909 | struct packed_git *p; |
| 910 | }; |
| 911 | |
Linus Torvalds | d1c133f | 2005-07-16 13:55:50 -0700 | [diff] [blame] | 912 | struct ref { |
| 913 | struct ref *next; |
| 914 | unsigned char old_sha1[20]; |
| 915 | unsigned char new_sha1[20]; |
Daniel Barkalow | be885d9 | 2008-04-26 15:53:12 -0400 | [diff] [blame] | 916 | char *symref; |
Shawn O. Pearce | 9f8a15c | 2007-11-18 04:31:37 -0500 | [diff] [blame] | 917 | unsigned int force:1, |
| 918 | merge:1, |
| 919 | nonfastforward:1, |
| 920 | deletion:1; |
Jeff King | 8736a84 | 2007-11-17 07:54:27 -0500 | [diff] [blame] | 921 | enum { |
| 922 | REF_STATUS_NONE = 0, |
| 923 | REF_STATUS_OK, |
| 924 | REF_STATUS_REJECT_NONFASTFORWARD, |
| 925 | REF_STATUS_REJECT_NODELETE, |
| 926 | REF_STATUS_UPTODATE, |
Jeff King | ca74c45 | 2007-11-17 07:56:03 -0500 | [diff] [blame] | 927 | REF_STATUS_REMOTE_REJECT, |
Gary V. Vaughan | 4b05548 | 2010-05-14 09:31:35 +0000 | [diff] [blame] | 928 | REF_STATUS_EXPECTING_REPORT |
Jeff King | 8736a84 | 2007-11-17 07:54:27 -0500 | [diff] [blame] | 929 | } status; |
Jeff King | 2a0fe89 | 2007-11-18 02:16:52 -0500 | [diff] [blame] | 930 | char *remote_status; |
Junio C Hamano | f88395a | 2005-08-03 16:35:29 -0700 | [diff] [blame] | 931 | struct ref *peer_ref; /* when renaming */ |
Junio C Hamano | 8f1d2e6 | 2006-01-07 01:33:54 -0800 | [diff] [blame] | 932 | char name[FLEX_ARRAY]; /* more */ |
Linus Torvalds | d1c133f | 2005-07-16 13:55:50 -0700 | [diff] [blame] | 933 | }; |
| 934 | |
Linus Torvalds | 2718ff0 | 2006-07-04 12:29:10 -0700 | [diff] [blame] | 935 | #define REF_NORMAL (1u << 0) |
| 936 | #define REF_HEADS (1u << 1) |
| 937 | #define REF_TAGS (1u << 2) |
| 938 | |
Jeff King | 5483f79 | 2009-02-25 03:32:10 -0500 | [diff] [blame] | 939 | extern struct ref *find_ref_by_name(const struct ref *list, const char *name); |
Jeff King | cda69f4 | 2007-11-18 02:13:10 -0500 | [diff] [blame] | 940 | |
Michael S. Tsirkin | 7841ce7 | 2007-05-16 20:09:41 +0300 | [diff] [blame] | 941 | #define CONNECT_VERBOSE (1u << 0) |
Frank Li | f206063 | 2010-03-04 20:59:50 +0100 | [diff] [blame] | 942 | extern char *git_getpass(const char *prompt); |
Daniel Barkalow | 4577370 | 2007-10-29 21:05:40 -0400 | [diff] [blame] | 943 | extern struct child_process *git_connect(int fd[2], const char *url, const char *prog, int flags); |
Johannes Sixt | 98158e9 | 2007-10-19 21:47:53 +0200 | [diff] [blame] | 944 | extern int finish_connect(struct child_process *conn); |
Linus Torvalds | 013e7c7 | 2005-07-04 13:24:30 -0700 | [diff] [blame] | 945 | extern int path_match(const char *path, int nr, char **match); |
Junio C Hamano | 40c155f | 2008-09-09 01:27:09 -0700 | [diff] [blame] | 946 | struct extra_have_objects { |
| 947 | int nr, alloc; |
| 948 | unsigned char (*array)[20]; |
| 949 | }; |
| 950 | extern struct ref **get_remote_heads(int in, struct ref **list, int nr_match, char **match, unsigned int flags, struct extra_have_objects *); |
Johannes Schindelin | 211b5f9 | 2005-10-28 04:48:54 +0200 | [diff] [blame] | 951 | extern int server_supports(const char *feature); |
Linus Torvalds | f719259 | 2005-07-04 11:57:58 -0700 | [diff] [blame] | 952 | |
Shawn O. Pearce | 7b64469 | 2010-04-19 07:23:08 -0700 | [diff] [blame] | 953 | extern struct packed_git *parse_pack_index(unsigned char *sha1, const char *idx_path); |
barkalow@iabervon.org | bf592c5 | 2005-07-31 20:53:44 -0400 | [diff] [blame] | 954 | |
Junio C Hamano | 9a217f2 | 2005-06-28 14:56:57 -0700 | [diff] [blame] | 955 | extern void prepare_packed_git(void); |
Shawn Pearce | fc04c41 | 2006-11-01 17:06:21 -0500 | [diff] [blame] | 956 | extern void reprepare_packed_git(void); |
barkalow@iabervon.org | bf592c5 | 2005-07-31 20:53:44 -0400 | [diff] [blame] | 957 | extern void install_packed_git(struct packed_git *pack); |
| 958 | |
Junio C Hamano | a6080a0 | 2007-06-07 00:04:01 -0700 | [diff] [blame] | 959 | extern struct packed_git *find_sha1_pack(const unsigned char *sha1, |
barkalow@iabervon.org | bf592c5 | 2005-07-31 20:53:44 -0400 | [diff] [blame] | 960 | struct packed_git *packs); |
| 961 | |
Chris Wedgwood | 276bc2c | 2007-01-16 22:28:02 -0800 | [diff] [blame] | 962 | extern void pack_report(void); |
Shawn O. Pearce | d079837 | 2007-05-26 01:24:19 -0400 | [diff] [blame] | 963 | extern int open_pack_index(struct packed_git *); |
Shawn O. Pearce | fa5fc15 | 2010-04-19 07:23:06 -0700 | [diff] [blame] | 964 | extern void close_pack_index(struct packed_git *); |
Felipe Contreras | 4b25d09 | 2009-05-01 12:06:36 +0300 | [diff] [blame] | 965 | extern unsigned char *use_pack(struct packed_git *, struct pack_window **, off_t, unsigned int *); |
Shawn O. Pearce | c9ced05 | 2008-01-17 22:57:00 -0500 | [diff] [blame] | 966 | extern void close_pack_windows(struct packed_git *); |
Shawn O. Pearce | 03e79c8 | 2006-12-23 02:34:08 -0500 | [diff] [blame] | 967 | extern void unuse_pack(struct pack_window **); |
Nicolas Pitre | c74faea | 2008-12-09 14:26:52 -0500 | [diff] [blame] | 968 | extern void free_pack_by_name(const char *); |
Shawn O. Pearce | 3d20c63 | 2009-02-10 13:36:12 -0800 | [diff] [blame] | 969 | extern void clear_delta_base_cache(void); |
Nicolas Pitre | 4287307 | 2007-03-16 16:42:50 -0400 | [diff] [blame] | 970 | extern struct packed_git *add_packed_git(const char *, int, int); |
Shawn O. Pearce | d079837 | 2007-05-26 01:24:19 -0400 | [diff] [blame] | 971 | extern const unsigned char *nth_packed_object_sha1(struct packed_git *, uint32_t); |
Nicolas Pitre | 9909323 | 2008-06-24 23:17:12 -0400 | [diff] [blame] | 972 | extern off_t nth_packed_object_offset(const struct packed_git *, uint32_t); |
Shawn O. Pearce | c4001d9 | 2007-03-06 20:44:30 -0500 | [diff] [blame] | 973 | extern off_t find_pack_entry_one(const unsigned char *, struct packed_git *); |
| 974 | extern void *unpack_entry(struct packed_git *, off_t, enum object_type *, unsigned long *); |
Nicolas Pitre | 09ded04 | 2008-10-29 19:02:46 -0400 | [diff] [blame] | 975 | extern unsigned long unpack_object_header_buffer(const unsigned char *buf, unsigned long len, enum object_type *type, unsigned long *sizep); |
Nicolas Pitre | 54dab52 | 2007-04-16 12:31:56 -0400 | [diff] [blame] | 976 | extern unsigned long get_size_from_delta(struct packed_git *, struct pack_window **, off_t); |
Shawn O. Pearce | c4001d9 | 2007-03-06 20:44:30 -0500 | [diff] [blame] | 977 | extern const char *packed_object_info_detail(struct packed_git *, off_t, unsigned long *, unsigned long *, unsigned int *, unsigned char *); |
Junio C Hamano | 9a217f2 | 2005-06-28 14:56:57 -0700 | [diff] [blame] | 978 | |
Junio C Hamano | 8f3f9b0 | 2005-07-23 17:54:41 -0700 | [diff] [blame] | 979 | /* Dumb servers support */ |
| 980 | extern int update_server_info(int); |
| 981 | |
Johannes Schindelin | ef90d6d | 2008-05-14 18:46:53 +0100 | [diff] [blame] | 982 | typedef int (*config_fn_t)(const char *, const char *, void *); |
| 983 | extern int git_default_config(const char *, const char *, void *); |
| 984 | extern int git_config_from_file(config_fn_t fn, const char *, void *); |
Jeff King | 2b64fc8 | 2010-08-23 15:16:00 -0400 | [diff] [blame] | 985 | extern void git_config_push_parameter(const char *text); |
Alex Riesen | 8b1fa77 | 2010-03-26 23:53:57 +0100 | [diff] [blame] | 986 | extern int git_config_parse_parameter(const char *text); |
Jeff King | 2b64fc8 | 2010-08-23 15:16:00 -0400 | [diff] [blame] | 987 | extern int git_config_parse_environment(void); |
Thomas Rast | b3d83d9 | 2010-05-21 12:07:47 +0200 | [diff] [blame] | 988 | extern int git_config_from_parameters(config_fn_t fn, void *data); |
Johannes Schindelin | ef90d6d | 2008-05-14 18:46:53 +0100 | [diff] [blame] | 989 | extern int git_config(config_fn_t fn, void *); |
Brian Downing | 0b87b6e | 2007-07-12 08:32:26 -0500 | [diff] [blame] | 990 | extern int git_parse_ulong(const char *, unsigned long *); |
Linus Torvalds | 1771299 | 2005-10-10 16:31:08 -0700 | [diff] [blame] | 991 | extern int git_config_int(const char *, const char *); |
Brian Downing | 0b87b6e | 2007-07-12 08:32:26 -0500 | [diff] [blame] | 992 | extern unsigned long git_config_ulong(const char *, const char *); |
Junio C Hamano | a53f2ec | 2008-04-12 18:33:31 -0700 | [diff] [blame] | 993 | extern int git_config_bool_or_int(const char *, const char *, int *); |
Linus Torvalds | 1771299 | 2005-10-10 16:31:08 -0700 | [diff] [blame] | 994 | extern int git_config_bool(const char *, const char *); |
Junio C Hamano | 8420ccd | 2010-02-16 23:59:46 -0800 | [diff] [blame] | 995 | extern int git_config_maybe_bool(const char *, const char *); |
Christian Couder | ea5105a | 2008-02-16 06:00:24 +0100 | [diff] [blame] | 996 | extern int git_config_string(const char **, const char *, const char *); |
Matthieu Moy | 395de25 | 2009-11-17 18:24:25 +0100 | [diff] [blame] | 997 | extern int git_config_pathname(const char **, const char *, const char *); |
Johannes Schindelin | 10bea15 | 2005-11-17 22:32:36 +0100 | [diff] [blame] | 998 | extern int git_config_set(const char *, const char *); |
Johannes Schindelin | 4ddba79 | 2005-11-20 06:52:22 +0100 | [diff] [blame] | 999 | extern int git_config_set_multivar(const char *, const char *, const char *, int); |
Johannes Schindelin | 0667fcf | 2006-12-16 15:14:14 +0100 | [diff] [blame] | 1000 | extern int git_config_rename_section(const char *, const char *); |
Johannes Sixt | 506b17b | 2007-11-13 21:05:05 +0100 | [diff] [blame] | 1001 | extern const char *git_etc_gitconfig(void); |
Johannes Schindelin | ef90d6d | 2008-05-14 18:46:53 +0100 | [diff] [blame] | 1002 | extern int check_repository_format_version(const char *var, const char *value, void *cb); |
Lars R. Damerow | 0ef3716 | 2010-03-17 12:55:51 -0700 | [diff] [blame] | 1003 | extern int git_env_bool(const char *, int); |
Jeff King | ab88c36 | 2008-02-06 05:11:18 -0500 | [diff] [blame] | 1004 | extern int git_config_system(void); |
| 1005 | extern int git_config_global(void); |
Junio C Hamano | 40ea4ed | 2008-02-11 10:41:18 -0800 | [diff] [blame] | 1006 | extern int config_error_nonbool(const char *); |
Pat Notz | a6fa599 | 2010-11-02 13:59:07 -0600 | [diff] [blame] | 1007 | extern const char *get_log_output_encoding(void); |
| 1008 | extern const char *get_commit_output_encoding(void); |
| 1009 | |
Daniel Barkalow | dc87183 | 2008-06-30 03:37:47 -0400 | [diff] [blame] | 1010 | extern const char *config_exclusive_filename; |
Linus Torvalds | 1771299 | 2005-10-10 16:31:08 -0700 | [diff] [blame] | 1011 | |
Linus Torvalds | e1b1039 | 2005-10-11 18:47:34 -0700 | [diff] [blame] | 1012 | #define MAX_GITNAME (1000) |
| 1013 | extern char git_default_email[MAX_GITNAME]; |
| 1014 | extern char git_default_name[MAX_GITNAME]; |
Junio C Hamano | 91c38a2 | 2010-01-08 07:39:11 -0800 | [diff] [blame] | 1015 | #define IDENT_NAME_GIVEN 01 |
| 1016 | #define IDENT_MAIL_GIVEN 02 |
| 1017 | #define IDENT_ALL_GIVEN (IDENT_NAME_GIVEN|IDENT_MAIL_GIVEN) |
Santi Béjar | bb1ae3f | 2008-05-04 18:04:51 +0200 | [diff] [blame] | 1018 | extern int user_ident_explicitly_given; |
Junio C Hamano | 5aeb3a3 | 2010-01-17 13:54:28 -0800 | [diff] [blame] | 1019 | extern int user_ident_sufficiently_given(void); |
Linus Torvalds | e1b1039 | 2005-10-11 18:47:34 -0700 | [diff] [blame] | 1020 | |
Shawn O. Pearce | 1a8f274 | 2007-03-12 15:33:18 -0400 | [diff] [blame] | 1021 | extern const char *git_commit_encoding; |
Shawn O. Pearce | 3a55602 | 2007-03-06 20:44:17 -0500 | [diff] [blame] | 1022 | extern const char *git_log_output_encoding; |
Marius Storm-Olsen | d551a48 | 2009-02-08 15:34:27 +0100 | [diff] [blame] | 1023 | extern const char *git_mailmap_file; |
Junio C Hamano | 4e72dce | 2005-11-27 16:09:40 -0800 | [diff] [blame] | 1024 | |
Theodore Ts'o | 06f59e9 | 2007-06-29 13:40:46 -0400 | [diff] [blame] | 1025 | /* IO helper functions */ |
| 1026 | extern void maybe_flush_or_die(FILE *, const char *); |
Junio C Hamano | f3123c4 | 2005-10-22 01:28:13 -0700 | [diff] [blame] | 1027 | extern int copy_fd(int ifd, int ofd); |
Daniel Barkalow | 1468bd4 | 2008-02-25 14:24:48 -0500 | [diff] [blame] | 1028 | extern int copy_file(const char *dst, const char *src, int mode); |
Clemens Buchacher | f7835a2 | 2009-09-12 11:03:48 +0200 | [diff] [blame] | 1029 | extern int copy_file_with_time(const char *dst, const char *src, int mode); |
Rene Scharfe | 7230e6d | 2006-08-21 20:43:43 +0200 | [diff] [blame] | 1030 | extern void write_or_die(int fd, const void *buf, size_t count); |
Christian Couder | 6ce4e61 | 2006-09-02 18:23:48 +0200 | [diff] [blame] | 1031 | extern int write_or_whine(int fd, const void *buf, size_t count, const char *msg); |
Andy Whitcroft | e081405 | 2007-01-08 15:57:52 +0000 | [diff] [blame] | 1032 | extern int write_or_whine_pipe(int fd, const void *buf, size_t count, const char *msg); |
Linus Torvalds | 4c81b03 | 2008-05-30 08:42:16 -0700 | [diff] [blame] | 1033 | extern void fsync_or_die(int fd, const char *); |
Junio C Hamano | ad89721 | 2005-12-14 22:17:38 -0800 | [diff] [blame] | 1034 | |
Jim Meyering | 2b7ca83 | 2009-09-12 10:54:32 +0200 | [diff] [blame] | 1035 | extern ssize_t read_in_full(int fd, void *buf, size_t count); |
| 1036 | extern ssize_t write_in_full(int fd, const void *buf, size_t count); |
| 1037 | static inline ssize_t write_str_in_full(int fd, const char *str) |
| 1038 | { |
| 1039 | return write_in_full(fd, str, strlen(str)); |
| 1040 | } |
| 1041 | |
Linus Torvalds | f67b45f | 2006-02-28 11:26:21 -0800 | [diff] [blame] | 1042 | /* pager.c */ |
| 1043 | extern void setup_pager(void); |
Christian Couder | 872da32 | 2008-02-16 06:01:11 +0100 | [diff] [blame] | 1044 | extern const char *pager_program; |
Jeff King | 6e9af86 | 2007-12-11 01:27:33 -0500 | [diff] [blame] | 1045 | extern int pager_in_use(void); |
Matthias Lederhofer | aa086eb | 2006-07-30 00:27:43 +0200 | [diff] [blame] | 1046 | extern int pager_use_color; |
Linus Torvalds | f67b45f | 2006-02-28 11:26:21 -0800 | [diff] [blame] | 1047 | |
Christian Couder | ee9601e | 2008-02-16 06:01:41 +0100 | [diff] [blame] | 1048 | extern const char *editor_program; |
Anselm Kruis | d3e7da8 | 2010-08-30 15:38:38 +0200 | [diff] [blame] | 1049 | extern const char *askpass_program; |
Christian Couder | dfb068b | 2008-02-16 06:01:59 +0100 | [diff] [blame] | 1050 | extern const char *excludes_file; |
Johannes Schindelin | 4d87b9c | 2007-07-20 13:06:09 +0100 | [diff] [blame] | 1051 | |
Junio C Hamano | 051308f | 2006-05-04 16:51:44 -0700 | [diff] [blame] | 1052 | /* base85 */ |
Jim Meyering | f981577 | 2007-04-10 00:56:33 +0200 | [diff] [blame] | 1053 | int decode_85(char *dst, const char *line, int linelen); |
| 1054 | void encode_85(char *buf, const unsigned char *data, int bytes); |
Junio C Hamano | 051308f | 2006-05-04 16:51:44 -0700 | [diff] [blame] | 1055 | |
Linus Torvalds | 855419f | 2006-06-19 10:44:15 -0700 | [diff] [blame] | 1056 | /* alloc.c */ |
Linus Torvalds | 100c5f3 | 2007-04-16 22:11:43 -0700 | [diff] [blame] | 1057 | extern void *alloc_blob_node(void); |
| 1058 | extern void *alloc_tree_node(void); |
| 1059 | extern void *alloc_commit_node(void); |
| 1060 | extern void *alloc_tag_node(void); |
| 1061 | extern void *alloc_object_node(void); |
Linus Torvalds | 855419f | 2006-06-19 10:44:15 -0700 | [diff] [blame] | 1062 | extern void alloc_report(void); |
| 1063 | |
Christian Couder | 6ce4e61 | 2006-09-02 18:23:48 +0200 | [diff] [blame] | 1064 | /* trace.c */ |
Tarmigan Casebolt | 28bea9e | 2009-11-14 13:33:13 -0800 | [diff] [blame] | 1065 | __attribute__((format (printf, 1, 2))) |
Christian Couder | 6ce4e61 | 2006-09-02 18:23:48 +0200 | [diff] [blame] | 1066 | extern void trace_printf(const char *format, ...); |
Tarmigan Casebolt | 28bea9e | 2009-11-14 13:33:13 -0800 | [diff] [blame] | 1067 | __attribute__((format (printf, 2, 3))) |
Christian Couder | b319ce4 | 2007-12-03 05:51:50 +0100 | [diff] [blame] | 1068 | extern void trace_argv_printf(const char **argv, const char *format, ...); |
Christian Couder | 6ce4e61 | 2006-09-02 18:23:48 +0200 | [diff] [blame] | 1069 | |
Linus Torvalds | 6c510be | 2007-02-13 11:07:23 -0800 | [diff] [blame] | 1070 | /* convert.c */ |
Pierre Habouzit | 5ecd293 | 2007-09-16 15:51:04 +0200 | [diff] [blame] | 1071 | /* returns 1 if *dst was used */ |
Steffen Prohaska | 21e5ad5 | 2008-02-06 12:25:58 +0100 | [diff] [blame] | 1072 | extern int convert_to_git(const char *path, const char *src, size_t len, |
| 1073 | struct strbuf *dst, enum safe_crlf checksafe); |
Pierre Habouzit | 5ecd293 | 2007-09-16 15:51:04 +0200 | [diff] [blame] | 1074 | extern int convert_to_working_tree(const char *path, const char *src, size_t len, struct strbuf *dst); |
Eyvind Bernhardsen | f217f0e | 2010-07-02 21:20:47 +0200 | [diff] [blame] | 1075 | extern int renormalize_buffer(const char *path, const char *src, size_t len, struct strbuf *dst); |
Linus Torvalds | 6c510be | 2007-02-13 11:07:23 -0800 | [diff] [blame] | 1076 | |
Junio C Hamano | b6ec1d6 | 2007-11-18 01:12:04 -0800 | [diff] [blame] | 1077 | /* add */ |
Alex Riesen | 7ae02a3 | 2008-05-12 19:58:10 +0200 | [diff] [blame] | 1078 | /* |
| 1079 | * return 0 if success, 1 - if addition of a file failed and |
| 1080 | * ADD_FILES_IGNORE_ERRORS was specified in flags |
| 1081 | */ |
| 1082 | int add_files_to_cache(const char *prefix, const char **pathspec, int flags); |
Junio C Hamano | b6ec1d6 | 2007-11-18 01:12:04 -0800 | [diff] [blame] | 1083 | |
Junio C Hamano | aecbf91 | 2007-08-31 13:13:42 -0700 | [diff] [blame] | 1084 | /* diff.c */ |
| 1085 | extern int diff_auto_refresh_index; |
| 1086 | |
Junio C Hamano | 68faf68 | 2007-02-15 16:32:45 -0800 | [diff] [blame] | 1087 | /* match-trees.c */ |
| 1088 | void shift_tree(const unsigned char *, const unsigned char *, unsigned char *, int); |
Junio C Hamano | 85e51b7 | 2008-06-30 22:18:57 -0700 | [diff] [blame] | 1089 | void shift_tree_by(const unsigned char *, const unsigned char *, unsigned char *, const char *); |
Junio C Hamano | 68faf68 | 2007-02-15 16:32:45 -0800 | [diff] [blame] | 1090 | |
Junio C Hamano | a9cc857 | 2007-11-02 00:24:27 -0700 | [diff] [blame] | 1091 | /* |
| 1092 | * whitespace rules. |
| 1093 | * used by both diff and apply |
| 1094 | */ |
Junio C Hamano | aeb84b0 | 2009-09-05 22:21:17 -0700 | [diff] [blame] | 1095 | #define WS_BLANK_AT_EOL 01 |
Junio C Hamano | a9cc857 | 2007-11-02 00:24:27 -0700 | [diff] [blame] | 1096 | #define WS_SPACE_BEFORE_TAB 02 |
Junio C Hamano | 459fa6d | 2007-10-02 18:00:27 -0700 | [diff] [blame] | 1097 | #define WS_INDENT_WITH_NON_TAB 04 |
Junio C Hamano | b2979ff | 2008-01-15 00:59:05 -0800 | [diff] [blame] | 1098 | #define WS_CR_AT_EOL 010 |
Junio C Hamano | 77b15bb | 2009-09-03 16:02:32 -0700 | [diff] [blame] | 1099 | #define WS_BLANK_AT_EOF 020 |
Chris Webb | 3e3ec2a | 2010-04-03 00:37:08 +0100 | [diff] [blame] | 1100 | #define WS_TAB_IN_INDENT 040 |
Junio C Hamano | aeb84b0 | 2009-09-05 22:21:17 -0700 | [diff] [blame] | 1101 | #define WS_TRAILING_SPACE (WS_BLANK_AT_EOL|WS_BLANK_AT_EOF) |
Junio C Hamano | a9cc857 | 2007-11-02 00:24:27 -0700 | [diff] [blame] | 1102 | #define WS_DEFAULT_RULE (WS_TRAILING_SPACE|WS_SPACE_BEFORE_TAB) |
Junio C Hamano | cf1b786 | 2007-12-06 00:14:14 -0800 | [diff] [blame] | 1103 | extern unsigned whitespace_rule_cfg; |
| 1104 | extern unsigned whitespace_rule(const char *); |
| 1105 | extern unsigned parse_whitespace_rule(const char *); |
Junio C Hamano | 8f8841e | 2008-06-26 15:35:21 -0700 | [diff] [blame] | 1106 | extern unsigned ws_check(const char *line, int len, unsigned ws_rule); |
| 1107 | extern void ws_check_emit(const char *line, int len, unsigned ws_rule, FILE *stream, const char *set, const char *reset, const char *ws); |
Wincent Colaiuta | c1795bb | 2007-12-13 14:32:29 +0100 | [diff] [blame] | 1108 | extern char *whitespace_error_string(unsigned ws); |
Chris Webb | d511bd3 | 2010-04-03 00:37:23 +0100 | [diff] [blame] | 1109 | extern void ws_fix_copy(struct strbuf *, const char *, int, unsigned, int *); |
Junio C Hamano | 877f23c | 2008-06-26 15:36:59 -0700 | [diff] [blame] | 1110 | extern int ws_blank_line(const char *line, int len, unsigned ws_rule); |
Junio C Hamano | a9cc857 | 2007-11-02 00:24:27 -0700 | [diff] [blame] | 1111 | |
Junio C Hamano | ee425e4 | 2007-11-18 01:13:32 -0800 | [diff] [blame] | 1112 | /* ls-files */ |
Junio C Hamano | ee425e4 | 2007-11-18 01:13:32 -0800 | [diff] [blame] | 1113 | int report_path_error(const char *ps_matched, const char **pathspec, int prefix_offset); |
| 1114 | void overlay_tree_on_cache(const char *tree_name, const char *prefix); |
| 1115 | |
Jeff King | 9435111 | 2008-02-24 17:17:14 -0500 | [diff] [blame] | 1116 | char *alias_lookup(const char *alias); |
Miklos Vajna | 0989fe9 | 2008-06-27 18:21:54 +0200 | [diff] [blame] | 1117 | int split_cmdline(char *cmdline, const char ***argv); |
Greg Brockman | ad9ac6d | 2010-08-07 01:13:39 -0400 | [diff] [blame] | 1118 | /* Takes a negative value returned by split_cmdline */ |
| 1119 | const char *split_cmdline_strerror(int cmdline_errno); |
Jeff King | 9435111 | 2008-02-24 17:17:14 -0500 | [diff] [blame] | 1120 | |
Nguyễn Thái Ngọc Duy | e37c132 | 2010-08-05 21:40:35 -0500 | [diff] [blame] | 1121 | /* git.c */ |
| 1122 | struct startup_info { |
Nguyễn Thái Ngọc Duy | a60645f | 2010-08-05 21:46:33 -0500 | [diff] [blame] | 1123 | int have_repository; |
Nguyễn Thái Ngọc Duy | e37c132 | 2010-08-05 21:40:35 -0500 | [diff] [blame] | 1124 | }; |
| 1125 | extern struct startup_info *startup_info; |
| 1126 | |
Junio C Hamano | cac42b2 | 2010-03-06 21:34:41 +0100 | [diff] [blame] | 1127 | /* builtin/merge.c */ |
| 1128 | int checkout_fast_forward(const unsigned char *from, const unsigned char *to); |
| 1129 | |
Linus Torvalds | e83c516 | 2005-04-07 15:13:13 -0700 | [diff] [blame] | 1130 | #endif /* CACHE_H */ |