summaryrefslogtreecommitdiff
path: root/pack.h
diff options
context:
space:
mode:
authorLibravatar Shawn O. Pearce <spearce@spearce.org>2007-01-30 11:07:24 -0500
committerLibravatar Shawn O. Pearce <spearce@spearce.org>2007-01-30 11:07:24 -0500
commit76db9dec8132d4377f6c32e4d45eb75fa0cc7a9a (patch)
tree80a6b54d21978b5c3879662bdc4f5951f804b808 /pack.h
parentAccept 'inline' file data in fast-import commit structure. (diff)
parentblameview: Use git-cat-file to read the file content. (diff)
downloadtgif-76db9dec8132d4377f6c32e4d45eb75fa0cc7a9a.tar.xz
Merge branch 'master' into sp/gfi
git-fast-import requires use of inttypes.h, but the master branch has added it to git-compat-util differently than git-fast-import originally had used it. This merge back of master to the fast-import topic is to get (and use) inttypes.h the way master is using it. This is a partially evil merge to remove the call to setup_ident(), as the master branch now contains a change which makes this implicit and therefore removed the function declaration. (commit 01754769). Conflicts: git-compat-util.h
Diffstat (limited to 'pack.h')
-rw-r--r--pack.h39
1 files changed, 36 insertions, 3 deletions
diff --git a/pack.h b/pack.h
index 4814800f28..deb427edbe 100644
--- a/pack.h
+++ b/pack.h
@@ -10,10 +10,43 @@
#define PACK_VERSION 2
#define pack_version_ok(v) ((v) == htonl(2) || (v) == htonl(3))
struct pack_header {
- unsigned int hdr_signature;
- unsigned int hdr_version;
- unsigned int hdr_entries;
+ uint32_t hdr_signature;
+ uint32_t hdr_version;
+ uint32_t hdr_entries;
};
+/*
+ * Packed object index header
+ *
+ * struct pack_idx_header {
+ * uint32_t idx_signature;
+ * uint32_t idx_version;
+ * };
+ *
+ * Note: this header isn't active yet. In future versions of git
+ * we may change the index file format. At that time we would start
+ * the first four bytes of the new index format with this signature,
+ * as all older git binaries would find this value illegal and abort
+ * reading the file.
+ *
+ * This is the case because the number of objects in a packfile
+ * cannot exceed 1,431,660,000 as every object would need at least
+ * 3 bytes of data and the overall packfile cannot exceed 4 GiB due
+ * to the 32 bit offsets used by the index. Clearly the signature
+ * exceeds this maximum.
+ *
+ * Very old git binaries will also compare the first 4 bytes to the
+ * next 4 bytes in the index and abort with a "non-monotonic index"
+ * error if the second 4 byte word is smaller than the first 4
+ * byte word. This would be true in the proposed future index
+ * format as idx_signature would be greater than idx_version.
+ */
+#define PACK_IDX_SIGNATURE 0xff744f63 /* "\377tOc" */
+
extern int verify_pack(struct packed_git *, int);
+
+#define PH_ERROR_EOF (-1)
+#define PH_ERROR_PACK_SIGNATURE (-2)
+#define PH_ERROR_PROTOCOL (-3)
+extern int read_pack_header(int fd, struct pack_header *);
#endif