Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
1648fbd3
Commit
1648fbd3
authored
May 02, 2011
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Re-apply missing patches
parent
d4ad0771
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
25 deletions
+38
-25
include/git2/index.h
+13
-23
src/index.c
+23
-2
src/refs.c
+2
-0
No files found.
include/git2/index.h
View file @
1648fbd3
...
...
@@ -51,39 +51,29 @@ GIT_BEGIN_DECL
*
* In-memory only flags:
*/
#define GIT_IDXENTRY_UPDATE (1 <<
16
)
#define GIT_IDXENTRY_REMOVE (1 << 1
7
)
#define GIT_IDXENTRY_UPTODATE (1 <<
18
)
#define GIT_IDXENTRY_ADDED (1 <<
19
)
#define GIT_IDXENTRY_UPDATE (1 <<
0
)
#define GIT_IDXENTRY_REMOVE (1 << 1)
#define GIT_IDXENTRY_UPTODATE (1 <<
2
)
#define GIT_IDXENTRY_ADDED (1 <<
3
)
#define GIT_IDXENTRY_HASHED (1 <<
20
)
#define GIT_IDXENTRY_UNHASHED (1 <<
21
)
#define GIT_IDXENTRY_WT_REMOVE (1 <<
22
)
/* remove in work directory */
#define GIT_IDXENTRY_CONFLICTED (1 <<
23
)
#define GIT_IDXENTRY_HASHED (1 <<
4
)
#define GIT_IDXENTRY_UNHASHED (1 <<
5
)
#define GIT_IDXENTRY_WT_REMOVE (1 <<
6
)
/* remove in work directory */
#define GIT_IDXENTRY_CONFLICTED (1 <<
7
)
#define GIT_IDXENTRY_UNPACKED (1 <<
24
)
#define GIT_IDXENTRY_NEW_SKIP_WORKTREE (1 <<
25
)
#define GIT_IDXENTRY_UNPACKED (1 <<
8
)
#define GIT_IDXENTRY_NEW_SKIP_WORKTREE (1 <<
9
)
/*
* Extended on-disk flags:
*/
#define GIT_IDXENTRY_INTENT_TO_ADD (1 <<
29
)
#define GIT_IDXENTRY_SKIP_WORKTREE (1 <<
30
)
#define GIT_IDXENTRY_INTENT_TO_ADD (1 <<
13
)
#define GIT_IDXENTRY_SKIP_WORKTREE (1 <<
14
)
/* GIT_IDXENTRY_EXTENDED2 is for future extension */
#define GIT_IDXENTRY_EXTENDED2 (1 <<
31
)
#define GIT_IDXENTRY_EXTENDED2 (1 <<
15
)
#define GIT_IDXENTRY_EXTENDED_FLAGS (GIT_IDXENTRY_INTENT_TO_ADD | GIT_IDXENTRY_SKIP_WORKTREE)
/*
* Safeguard to avoid saving wrong flags:
* - GIT_IDXENTRY_EXTENDED2 won't get saved until its semantic is known
* - Bits in 0x0000FFFF have been saved in flags already
* - Bits in 0x003F0000 are currently in-memory flags
*/
#if GIT_IDXENTRY_EXTENDED_FLAGS & 0x803FFFFF
#error "GIT_IDXENTRY_EXTENDED_FLAGS out of range"
#endif
/** Time used in a git index entry */
typedef
struct
{
git_time_t
seconds
;
...
...
src/index.c
View file @
1648fbd3
...
...
@@ -101,6 +101,7 @@ static int read_tree(git_index *index, const char *buffer, size_t buffer_size);
static
git_index_tree
*
read_tree_internal
(
const
char
**
,
const
char
*
,
git_index_tree
*
);
static
int
parse_index
(
git_index
*
index
,
const
char
*
buffer
,
size_t
buffer_size
);
static
int
is_index_extended
(
git_index
*
index
);
static
void
sort_index
(
git_index
*
index
);
static
int
write_index
(
git_index
*
index
,
git_filebuf
*
file
);
...
...
@@ -718,6 +719,24 @@ static int parse_index(git_index *index, const char *buffer, size_t buffer_size)
return
GIT_SUCCESS
;
}
static
int
is_index_extended
(
git_index
*
index
)
{
unsigned
int
i
,
extended
;
extended
=
0
;
for
(
i
=
0
;
i
<
index
->
entries
.
length
;
++
i
)
{
git_index_entry
*
entry
;
entry
=
git_vector_get
(
&
index
->
entries
,
i
);
entry
->
flags
&=
~
GIT_IDXENTRY_EXTENDED
;
if
(
entry
->
flags_extended
&
GIT_IDXENTRY_EXTENDED_FLAGS
)
{
extended
++
;
entry
->
flags
|=
GIT_IDXENTRY_EXTENDED
;
}
}
return
extended
;
}
static
int
write_disk_entry
(
git_filebuf
*
file
,
git_index_entry
*
entry
)
{
struct
entry_short
*
ondisk
;
...
...
@@ -786,12 +805,14 @@ static int write_index(git_index *index, git_filebuf *file)
struct
index_header
header
;
int
is_extended
=
1
;
int
is_extended
;
assert
(
index
&&
file
);
is_extended
=
is_index_extended
(
index
);
header
.
signature
=
htonl
(
INDEX_HEADER_SIG
);
header
.
version
=
htonl
(
is_extended
?
INDEX_VERSION_NUMBER
:
INDEX_VERSION_NUMBER_EXT
);
header
.
version
=
htonl
(
is_extended
?
INDEX_VERSION_NUMBER
_EXT
:
INDEX_VERSION_NUMBER
);
header
.
entry_count
=
htonl
(
index
->
entries
.
length
);
git_filebuf_write
(
file
,
&
header
,
sizeof
(
struct
index_header
));
...
...
src/refs.c
View file @
1648fbd3
...
...
@@ -787,6 +787,8 @@ static int packed_find_peel(reference_oid *ref)
*/
}
git_object_close
(
object
);
return
GIT_SUCCESS
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment