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
410a8e6f
Commit
410a8e6f
authored
Jan 22, 2014
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sometimes a zero byte file is just a zero byte file
Don't go to the ODB to resolve zero byte files in the workdir
parent
2b678ce5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletions
+29
-1
src/diff_tform.c
+1
-1
tests/status/renames.c
+28
-0
No files found.
src/diff_tform.c
View file @
410a8e6f
...
...
@@ -472,7 +472,7 @@ static int similarity_init(
info
->
blob
=
NULL
;
git_buf_init
(
&
info
->
data
,
0
);
if
(
info
->
file
->
size
>
0
)
if
(
info
->
file
->
size
>
0
||
info
->
src
==
GIT_ITERATOR_TYPE_WORKDIR
)
return
0
;
return
git_diff_file__resolve_zero_size
(
...
...
tests/status/renames.c
View file @
410a8e6f
...
...
@@ -555,3 +555,31 @@ void test_status_renames__both_casechange_two(void)
git_index_free
(
index
);
}
void
test_status_renames__zero_byte_file_does_not_fail
(
void
)
{
git_status_list
*
statuslist
;
git_status_options
opts
=
GIT_STATUS_OPTIONS_INIT
;
status_entry_counts
counts
=
{
0
};
struct
status_entry
expected
[]
=
{
{
GIT_STATUS_WT_DELETED
,
"ikeepsix.txt"
,
"ikeepsix.txt"
},
{
GIT_STATUS_WT_NEW
,
"zerobyte.txt"
,
"zerobyte.txt"
},
};
opts
.
flags
|=
GIT_STATUS_OPT_RENAMES_FROM_REWRITES
|
GIT_STATUS_OPT_RENAMES_HEAD_TO_INDEX
|
GIT_STATUS_OPT_RENAMES_INDEX_TO_WORKDIR
|
GIT_STATUS_OPT_INCLUDE_IGNORED
|
GIT_STATUS_OPT_INCLUDE_UNTRACKED
|
GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS
|
GIT_STATUS_SHOW_INDEX_AND_WORKDIR
|
GIT_STATUS_OPT_RECURSE_IGNORED_DIRS
;
p_unlink
(
"renames/ikeepsix.txt"
);
cl_git_mkfile
(
"renames/zerobyte.txt"
,
""
);
cl_git_pass
(
git_status_list_new
(
&
statuslist
,
g_repo
,
&
opts
));
test_status
(
statuslist
,
expected
,
2
);
git_status_list_free
(
statuslist
);
}
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