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
5fa7e469
Commit
5fa7e469
authored
Apr 30, 2013
by
Russell Belfer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some formatting inconsistency
parent
61c00541
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
34 deletions
+22
-34
src/diff.c
+2
-4
src/diff_output.c
+20
-30
No files found.
src/diff.c
View file @
5fa7e469
...
@@ -327,8 +327,7 @@ static git_diff_list *diff_list_alloc(
...
@@ -327,8 +327,7 @@ static git_diff_list *diff_list_alloc(
/* Use case-insensitive compare if either iterator has
/* Use case-insensitive compare if either iterator has
* the ignore_case bit set */
* the ignore_case bit set */
if
(
!
git_iterator_ignore_case
(
old_iter
)
&&
if
(
!
git_iterator_ignore_case
(
old_iter
)
&&
!
git_iterator_ignore_case
(
new_iter
))
!
git_iterator_ignore_case
(
new_iter
))
{
{
diff
->
opts
.
flags
&=
~
GIT_DIFF_DELTAS_ARE_ICASE
;
diff
->
opts
.
flags
&=
~
GIT_DIFF_DELTAS_ARE_ICASE
;
diff
->
strcomp
=
git__strcmp
;
diff
->
strcomp
=
git__strcmp
;
...
@@ -777,8 +776,7 @@ static int handle_unmatched_new_item(
...
@@ -777,8 +776,7 @@ static int handle_unmatched_new_item(
/* if not already inside an ignored dir, check if this is ignored */
/* if not already inside an ignored dir, check if this is ignored */
if
(
delta_type
!=
GIT_DELTA_IGNORED
&&
if
(
delta_type
!=
GIT_DELTA_IGNORED
&&
git_iterator_current_is_ignored
(
info
->
new_iter
))
git_iterator_current_is_ignored
(
info
->
new_iter
))
{
{
delta_type
=
GIT_DELTA_IGNORED
;
delta_type
=
GIT_DELTA_IGNORED
;
git_buf_sets
(
&
info
->
ignore_prefix
,
nitem
->
path
);
git_buf_sets
(
&
info
->
ignore_prefix
,
nitem
->
path
);
}
}
...
...
src/diff_output.c
View file @
5fa7e469
...
@@ -101,8 +101,8 @@ static bool diff_delta_is_binary_forced(
...
@@ -101,8 +101,8 @@ static bool diff_delta_is_binary_forced(
/* make sure files are conceivably mmap-able */
/* make sure files are conceivably mmap-able */
if
((
git_off_t
)((
size_t
)
delta
->
old_file
.
size
)
!=
delta
->
old_file
.
size
||
if
((
git_off_t
)((
size_t
)
delta
->
old_file
.
size
)
!=
delta
->
old_file
.
size
||
(
git_off_t
)((
size_t
)
delta
->
new_file
.
size
)
!=
delta
->
new_file
.
size
)
(
git_off_t
)((
size_t
)
delta
->
new_file
.
size
)
!=
delta
->
new_file
.
size
)
{
{
delta
->
old_file
.
flags
|=
GIT_DIFF_FLAG_BINARY
;
delta
->
old_file
.
flags
|=
GIT_DIFF_FLAG_BINARY
;
delta
->
new_file
.
flags
|=
GIT_DIFF_FLAG_BINARY
;
delta
->
new_file
.
flags
|=
GIT_DIFF_FLAG_BINARY
;
delta
->
flags
|=
GIT_DIFF_FLAG_BINARY
;
delta
->
flags
|=
GIT_DIFF_FLAG_BINARY
;
...
@@ -232,8 +232,7 @@ static int get_blob_content(
...
@@ -232,8 +232,7 @@ static int get_blob_content(
if
(
git_oid_iszero
(
&
file
->
oid
))
if
(
git_oid_iszero
(
&
file
->
oid
))
return
0
;
return
0
;
if
(
file
->
mode
==
GIT_FILEMODE_COMMIT
)
if
(
file
->
mode
==
GIT_FILEMODE_COMMIT
)
{
{
char
oidstr
[
GIT_OID_HEXSZ
+
1
];
char
oidstr
[
GIT_OID_HEXSZ
+
1
];
git_buf
content
=
GIT_BUF_INIT
;
git_buf
content
=
GIT_BUF_INIT
;
...
@@ -299,8 +298,8 @@ static int get_workdir_sm_content(
...
@@ -299,8 +298,8 @@ static int get_workdir_sm_content(
char
oidstr
[
GIT_OID_HEXSZ
+
1
];
char
oidstr
[
GIT_OID_HEXSZ
+
1
];
if
((
error
=
git_submodule_lookup
(
&
sm
,
ctxt
->
repo
,
file
->
path
))
<
0
||
if
((
error
=
git_submodule_lookup
(
&
sm
,
ctxt
->
repo
,
file
->
path
))
<
0
||
(
error
=
git_submodule_status
(
&
sm_status
,
sm
))
<
0
)
(
error
=
git_submodule_status
(
&
sm_status
,
sm
))
<
0
)
{
{
/* GIT_EEXISTS means a "submodule" that has not been git added */
/* GIT_EEXISTS means a "submodule" that has not been git added */
if
(
error
==
GIT_EEXISTS
)
if
(
error
==
GIT_EEXISTS
)
error
=
0
;
error
=
0
;
...
@@ -312,8 +311,8 @@ static int get_workdir_sm_content(
...
@@ -312,8 +311,8 @@ static int get_workdir_sm_content(
const
git_oid
*
sm_head
;
const
git_oid
*
sm_head
;
if
((
sm_head
=
git_submodule_wd_id
(
sm
))
!=
NULL
||
if
((
sm_head
=
git_submodule_wd_id
(
sm
))
!=
NULL
||
(
sm_head
=
git_submodule_head_id
(
sm
))
!=
NULL
)
(
sm_head
=
git_submodule_head_id
(
sm
))
!=
NULL
)
{
{
git_oid_cpy
(
&
file
->
oid
,
sm_head
);
git_oid_cpy
(
&
file
->
oid
,
sm_head
);
file
->
flags
|=
GIT_DIFF_FLAG_VALID_OID
;
file
->
flags
|=
GIT_DIFF_FLAG_VALID_OID
;
}
}
...
@@ -660,8 +659,8 @@ static int diff_patch_load(
...
@@ -660,8 +659,8 @@ static int diff_patch_load(
*/
*/
if
(
check_if_unmodified
&&
if
(
check_if_unmodified
&&
delta
->
old_file
.
mode
==
delta
->
new_file
.
mode
&&
delta
->
old_file
.
mode
==
delta
->
new_file
.
mode
&&
!
git_oid__cmp
(
&
delta
->
old_file
.
oid
,
&
delta
->
new_file
.
oid
))
!
git_oid__cmp
(
&
delta
->
old_file
.
oid
,
&
delta
->
new_file
.
oid
))
{
{
delta
->
status
=
GIT_DELTA_UNMODIFIED
;
delta
->
status
=
GIT_DELTA_UNMODIFIED
;
if
((
ctxt
->
opts
->
flags
&
GIT_DIFF_INCLUDE_UNMODIFIED
)
==
0
)
if
((
ctxt
->
opts
->
flags
&
GIT_DIFF_INCLUDE_UNMODIFIED
)
==
0
)
...
@@ -1049,6 +1048,12 @@ char git_diff_status_char(git_delta_t status)
...
@@ -1049,6 +1048,12 @@ char git_diff_status_char(git_delta_t status)
return
code
;
return
code
;
}
}
static
int
callback_error
(
void
)
{
giterr_clear
();
return
GIT_EUSER
;
}
static
int
print_compact
(
static
int
print_compact
(
const
git_diff_delta
*
delta
,
float
progress
,
void
*
data
)
const
git_diff_delta
*
delta
,
float
progress
,
void
*
data
)
{
{
...
@@ -1083,10 +1088,7 @@ static int print_compact(
...
@@ -1083,10 +1088,7 @@ static int print_compact(
if
(
pi
->
print_cb
(
delta
,
NULL
,
GIT_DIFF_LINE_FILE_HDR
,
if
(
pi
->
print_cb
(
delta
,
NULL
,
GIT_DIFF_LINE_FILE_HDR
,
git_buf_cstr
(
pi
->
buf
),
git_buf_len
(
pi
->
buf
),
pi
->
payload
))
git_buf_cstr
(
pi
->
buf
),
git_buf_len
(
pi
->
buf
),
pi
->
payload
))
{
return
callback_error
();
giterr_clear
();
return
GIT_EUSER
;
}
return
0
;
return
0
;
}
}
...
@@ -1200,10 +1202,7 @@ static int print_patch_file(
...
@@ -1200,10 +1202,7 @@ static int print_patch_file(
if
(
pi
->
print_cb
(
delta
,
NULL
,
GIT_DIFF_LINE_FILE_HDR
,
if
(
pi
->
print_cb
(
delta
,
NULL
,
GIT_DIFF_LINE_FILE_HDR
,
git_buf_cstr
(
pi
->
buf
),
git_buf_len
(
pi
->
buf
),
pi
->
payload
))
git_buf_cstr
(
pi
->
buf
),
git_buf_len
(
pi
->
buf
),
pi
->
payload
))
{
return
callback_error
();
giterr_clear
();
return
GIT_EUSER
;
}
if
((
delta
->
flags
&
GIT_DIFF_FLAG_BINARY
)
==
0
)
if
((
delta
->
flags
&
GIT_DIFF_FLAG_BINARY
)
==
0
)
return
0
;
return
0
;
...
@@ -1217,10 +1216,7 @@ static int print_patch_file(
...
@@ -1217,10 +1216,7 @@ static int print_patch_file(
if
(
pi
->
print_cb
(
delta
,
NULL
,
GIT_DIFF_LINE_BINARY
,
if
(
pi
->
print_cb
(
delta
,
NULL
,
GIT_DIFF_LINE_BINARY
,
git_buf_cstr
(
pi
->
buf
),
git_buf_len
(
pi
->
buf
),
pi
->
payload
))
git_buf_cstr
(
pi
->
buf
),
git_buf_len
(
pi
->
buf
),
pi
->
payload
))
{
return
callback_error
();
giterr_clear
();
return
GIT_EUSER
;
}
return
0
;
return
0
;
}
}
...
@@ -1243,10 +1239,7 @@ static int print_patch_hunk(
...
@@ -1243,10 +1239,7 @@ static int print_patch_hunk(
if
(
pi
->
print_cb
(
d
,
r
,
GIT_DIFF_LINE_HUNK_HDR
,
if
(
pi
->
print_cb
(
d
,
r
,
GIT_DIFF_LINE_HUNK_HDR
,
git_buf_cstr
(
pi
->
buf
),
git_buf_len
(
pi
->
buf
),
pi
->
payload
))
git_buf_cstr
(
pi
->
buf
),
git_buf_len
(
pi
->
buf
),
pi
->
payload
))
{
return
callback_error
();
giterr_clear
();
return
GIT_EUSER
;
}
return
0
;
return
0
;
}
}
...
@@ -1278,10 +1271,7 @@ static int print_patch_line(
...
@@ -1278,10 +1271,7 @@ static int print_patch_line(
if
(
pi
->
print_cb
(
delta
,
range
,
line_origin
,
if
(
pi
->
print_cb
(
delta
,
range
,
line_origin
,
git_buf_cstr
(
pi
->
buf
),
git_buf_len
(
pi
->
buf
),
pi
->
payload
))
git_buf_cstr
(
pi
->
buf
),
git_buf_len
(
pi
->
buf
),
pi
->
payload
))
{
return
callback_error
();
giterr_clear
();
return
GIT_EUSER
;
}
return
0
;
return
0
;
}
}
...
...
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