Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
git
提交
f73a5e89
G
git
项目概览
李少辉-开发者
/
git
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
git
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f73a5e89
编写于
10月 18, 2006
作者:
J
Junio C Hamano
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'jc/diff-numstat'
* jc/diff-numstat: diff --numstat
上级
8719f93b
74e2abe5
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
47 addition
and
12 deletion
+47
-12
Documentation/diff-options.txt
Documentation/diff-options.txt
+5
-0
combine-diff.c
combine-diff.c
+6
-3
diff.c
diff.c
+27
-2
diff.h
diff.h
+9
-7
未找到文件。
Documentation/diff-options.txt
浏览文件 @
f73a5e89
...
...
@@ -16,6 +16,11 @@
The width of the filename part can be controlled by
giving another width to it separated by a comma.
--numstat::
Similar to \--stat, but shows number of added and
deleted lines in decimal notation and pathname without
abbreviation, to make it more machine friendly.
--summary::
Output a condensed summary of extended header information
such as creations, renames and mode changes.
...
...
combine-diff.c
浏览文件 @
f73a5e89
...
...
@@ -856,8 +856,10 @@ void diff_tree_combined(const unsigned char *sha1,
/* show stat against the first parent even
* when doing combined diff.
*/
if
(
i
==
0
&&
opt
->
output_format
&
DIFF_FORMAT_DIFFSTAT
)
diffopts
.
output_format
=
DIFF_FORMAT_DIFFSTAT
;
int
stat_opt
=
(
opt
->
output_format
&
(
DIFF_FORMAT_NUMSTAT
|
DIFF_FORMAT_DIFFSTAT
));
if
(
i
==
0
&&
stat_opt
)
diffopts
.
output_format
=
stat_opt
;
else
diffopts
.
output_format
=
DIFF_FORMAT_NO_OUTPUT
;
diff_tree_sha1
(
parent
[
i
],
sha1
,
""
,
&
diffopts
);
...
...
@@ -887,7 +889,8 @@ void diff_tree_combined(const unsigned char *sha1,
}
needsep
=
1
;
}
else
if
(
opt
->
output_format
&
DIFF_FORMAT_DIFFSTAT
)
else
if
(
opt
->
output_format
&
(
DIFF_FORMAT_NUMSTAT
|
DIFF_FORMAT_DIFFSTAT
))
needsep
=
1
;
if
(
opt
->
output_format
&
DIFF_FORMAT_PATCH
)
{
if
(
needsep
)
...
...
diff.c
浏览文件 @
f73a5e89
...
...
@@ -795,6 +795,23 @@ static void show_stats(struct diffstat_t* data, struct diff_options *options)
set
,
total_files
,
adds
,
dels
,
reset
);
}
static
void
show_numstat
(
struct
diffstat_t
*
data
,
struct
diff_options
*
options
)
{
int
i
;
for
(
i
=
0
;
i
<
data
->
nr
;
i
++
)
{
struct
diffstat_file
*
file
=
data
->
files
[
i
];
printf
(
"%d
\t
%d
\t
"
,
file
->
added
,
file
->
deleted
);
if
(
options
->
line_termination
&&
quote_c_style
(
file
->
name
,
NULL
,
NULL
,
0
))
quote_c_style
(
file
->
name
,
NULL
,
stdout
,
0
);
else
fputs
(
file
->
name
,
stdout
);
putchar
(
options
->
line_termination
);
}
}
struct
checkdiff_t
{
struct
xdiff_emit_state
xm
;
const
char
*
filename
;
...
...
@@ -1731,6 +1748,7 @@ int diff_setup_done(struct diff_options *options)
DIFF_FORMAT_CHECKDIFF
|
DIFF_FORMAT_NO_OUTPUT
))
options
->
output_format
&=
~
(
DIFF_FORMAT_RAW
|
DIFF_FORMAT_NUMSTAT
|
DIFF_FORMAT_DIFFSTAT
|
DIFF_FORMAT_SUMMARY
|
DIFF_FORMAT_PATCH
);
...
...
@@ -1740,6 +1758,7 @@ int diff_setup_done(struct diff_options *options)
* recursive bits for other formats here.
*/
if
(
options
->
output_format
&
(
DIFF_FORMAT_PATCH
|
DIFF_FORMAT_NUMSTAT
|
DIFF_FORMAT_DIFFSTAT
|
DIFF_FORMAT_CHECKDIFF
))
options
->
recursive
=
1
;
...
...
@@ -1828,6 +1847,9 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
else
if
(
!
strcmp
(
arg
,
"--patch-with-raw"
))
{
options
->
output_format
|=
DIFF_FORMAT_PATCH
|
DIFF_FORMAT_RAW
;
}
else
if
(
!
strcmp
(
arg
,
"--numstat"
))
{
options
->
output_format
|=
DIFF_FORMAT_NUMSTAT
;
}
else
if
(
!
strncmp
(
arg
,
"--stat"
,
6
))
{
char
*
end
;
int
width
=
options
->
stat_width
;
...
...
@@ -2602,7 +2624,7 @@ void diff_flush(struct diff_options *options)
separator
++
;
}
if
(
output_format
&
DIFF_FORMAT_DIFFSTAT
)
{
if
(
output_format
&
(
DIFF_FORMAT_DIFFSTAT
|
DIFF_FORMAT_NUMSTAT
)
)
{
struct
diffstat_t
diffstat
;
memset
(
&
diffstat
,
0
,
sizeof
(
struct
diffstat_t
));
...
...
@@ -2612,7 +2634,10 @@ void diff_flush(struct diff_options *options)
if
(
check_pair_status
(
p
))
diff_flush_stat
(
p
,
options
,
&
diffstat
);
}
show_stats
(
&
diffstat
,
options
);
if
(
output_format
&
DIFF_FORMAT_NUMSTAT
)
show_numstat
(
&
diffstat
,
options
);
if
(
output_format
&
DIFF_FORMAT_DIFFSTAT
)
show_stats
(
&
diffstat
,
options
);
separator
++
;
}
...
...
diff.h
浏览文件 @
f73a5e89
...
...
@@ -26,20 +26,21 @@ typedef void (*diff_format_fn_t)(struct diff_queue_struct *q,
#define DIFF_FORMAT_RAW 0x0001
#define DIFF_FORMAT_DIFFSTAT 0x0002
#define DIFF_FORMAT_SUMMARY 0x0004
#define DIFF_FORMAT_PATCH 0x0008
#define DIFF_FORMAT_NUMSTAT 0x0004
#define DIFF_FORMAT_SUMMARY 0x0008
#define DIFF_FORMAT_PATCH 0x0010
/* These override all above */
#define DIFF_FORMAT_NAME 0x0
01
0
#define DIFF_FORMAT_NAME_STATUS 0x0
02
0
#define DIFF_FORMAT_CHECKDIFF 0x0
04
0
#define DIFF_FORMAT_NAME 0x0
10
0
#define DIFF_FORMAT_NAME_STATUS 0x0
20
0
#define DIFF_FORMAT_CHECKDIFF 0x0
40
0
/* Same as output_format = 0 but we know that -s flag was given
* and we should not give default value to output_format.
*/
#define DIFF_FORMAT_NO_OUTPUT 0x0
08
0
#define DIFF_FORMAT_NO_OUTPUT 0x0
80
0
#define DIFF_FORMAT_CALLBACK 0x
01
00
#define DIFF_FORMAT_CALLBACK 0x
10
00
struct
diff_options
{
const
char
*
filter
;
...
...
@@ -170,6 +171,7 @@ extern void diffcore_std_no_resolve(struct diff_options *);
" --patch-with-raw\n" \
" output both a patch and the diff-raw format.\n" \
" --stat show diffstat instead of patch.\n" \
" --numstat show numeric diffstat instead of patch.\n" \
" --patch-with-stat\n" \
" output a patch and prepend its diffstat.\n" \
" --name-only show only names of changed files.\n" \
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录