Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
libgit2/src/pack.h at development · jpfender/libgit2 · GitHub
Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
See all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
jpfender
libgit2
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
More
items
Files
Expand file tree
development
Breadcrumbs
libgit2
/
src
/
pack.h
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
99 lines (81 loc) · 2.62 KB
development
Breadcrumbs
libgit2
/
src
/
pack.h
Copy path
Top
File metadata and controls
Code
Blame
99 lines (81 loc) · 2.62 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
* Copyright (C) 2009-2012 the libgit2 contributors
*
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
#ifndef
INCLUDE_pack_h__
#define
INCLUDE_pack_h__
#include
"git2/oid.h"
#include
"common.h"
#include
"map.h"
#include
"mwindow.h"
#include
"odb.h"
#define
GIT_PACK_FILE_MODE
0444
#define
PACK_SIGNATURE
0x5041434b
/* "PACK" */
#define
PACK_VERSION
2
#define
pack_version_ok
(
v
) ((v) == htonl(2) || (v) == htonl(3))
struct
git_pack_header
{
uint32_t
hdr_signature
;
uint32_t
hdr_version
;
uint32_t
hdr_entries
;
};
/*
* The first four bytes of index formats later than version 1 should
* start 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 with
* version 1 of the index file due to the offsets limited to 32 bits.
* 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" */
struct
git_pack_idx_header
{
uint32_t
idx_signature
;
uint32_t
idx_version
;
};
struct
git_pack_file
{
git_mwindow_file
mwf
;
git_map
index_map
;
uint32_t
num_objects
;
uint32_t
num_bad_objects
;
git_oid
*
bad_object_sha1
;
/* array of git_oid */
int
index_version
;
git_time_t
mtime
;
unsigned
pack_local
:
1
,
pack_keep
:
1
,
has_cache
:
1
;
git_oid
sha1
;
git_vector
cache
;
/* something like ".git/objects/pack/xxxxx.pack" */
char
pack_name
[
GIT_FLEX_ARRAY
];
/* more */
};
struct
git_pack_entry
{
off_t
offset
;
git_oid
sha1
;
struct
git_pack_file
*
p
;
};
int
git_packfile_unpack_header
(
size_t
*
size_p
,
git_otype
*
type_p
,
git_mwindow_file
*
mwf
,
git_mwindow
*
*
w_curs
,
off_t
*
curpos
);
int
git_packfile_unpack
(
git_rawobj
*
obj
,
struct
git_pack_file
*
p
,
off_t
*
obj_offset
);
off_t
get_delta_base
(
struct
git_pack_file
*
p
,
git_mwindow
*
*
w_curs
,
off_t
*
curpos
,
git_otype
type
,
off_t
delta_obj_offset
);
void
packfile_free
(
struct
git_pack_file
*
p
);
int
git_packfile_check
(
struct
git_pack_file
*
*
pack_out
,
const
char
*
path
);
int
git_pack_entry_find
(
struct
git_pack_entry
*
e
,
struct
git_pack_file
*
p
,
const
git_oid
*
short_oid
,
unsigned
int
len
);
#endif
You can’t perform that action at this time.