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
89ddd0fc
Unverified
Commit
89ddd0fc
authored
Jun 01, 2020
by
Patrick Steinhardt
Committed by
GitHub
Jun 01, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5533 from pjw91/fix-index-write
Make git_index_write() generate valid v4 index
parents
27cb4e0e
1a899008
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
src/index.c
+2
-2
tests/index/version.c
+4
-1
No files found.
src/index.c
View file @
89ddd0fc
...
...
@@ -2744,7 +2744,7 @@ static int write_disk_entry(git_filebuf *file, git_index_entry *entry, const cha
++
same_len
;
}
path_len
-=
same_len
;
varint_len
=
git_encode_varint
(
NULL
,
0
,
same_len
);
varint_len
=
git_encode_varint
(
NULL
,
0
,
s
trlen
(
last
)
-
s
ame_len
);
}
disk_size
=
index_entry_size
(
path_len
,
varint_len
,
entry
->
flags
);
...
...
@@ -2795,7 +2795,7 @@ static int write_disk_entry(git_filebuf *file, git_index_entry *entry, const cha
if
(
last
)
{
varint_len
=
git_encode_varint
((
unsigned
char
*
)
path
,
disk_size
,
same_len
);
disk_size
,
s
trlen
(
last
)
-
s
ame_len
);
assert
(
varint_len
>
0
);
path
+=
varint_len
;
disk_size
-=
varint_len
;
...
...
tests/index/version.c
View file @
89ddd0fc
...
...
@@ -43,6 +43,7 @@ void test_index_version__can_write_v4(void)
"xz"
,
"xyzzyx"
};
git_repository
*
repo
;
git_index_entry
entry
;
git_index
*
index
;
size_t
i
;
...
...
@@ -63,7 +64,8 @@ void test_index_version__can_write_v4(void)
cl_git_pass
(
git_index_write
(
index
));
git_index_free
(
index
);
cl_git_pass
(
git_repository_index
(
&
index
,
g_repo
));
cl_git_pass
(
git_repository_open
(
&
repo
,
git_repository_path
(
g_repo
)));
cl_git_pass
(
git_repository_index
(
&
index
,
repo
));
cl_assert
(
git_index_version
(
index
)
==
4
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
paths
);
i
++
)
{
...
...
@@ -74,6 +76,7 @@ void test_index_version__can_write_v4(void)
}
git_index_free
(
index
);
git_repository_free
(
repo
);
}
void
test_index_version__v4_uses_path_compression
(
void
)
...
...
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