Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
git
提交
c24fe420
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,发现更多精彩内容 >>
提交
c24fe420
编写于
5月 01, 2006
作者:
J
Junio C Hamano
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
show-branch: omit uninteresting merges.
Signed-off-by:
N
Junio C Hamano
<
junkio@cox.net
>
上级
746437d5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
30 addition
and
3 deletion
+30
-3
show-branch.c
show-branch.c
+30
-3
未找到文件。
show-branch.c
浏览文件 @
c24fe420
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
#include "refs.h"
#include "refs.h"
static
const
char
show_branch_usage
[]
=
static
const
char
show_branch_usage
[]
=
"git-show-branch [--current] [--all] [--heads] [--tags] [--topo-order] [--more=count | --list | --independent | --merge-base ] [--topics] [<refs>...]"
;
"git-show-branch [--
dense] [--
current] [--all] [--heads] [--tags] [--topo-order] [--more=count | --list | --independent | --merge-base ] [--topics] [<refs>...]"
;
static
int
default_num
=
0
;
static
int
default_num
=
0
;
static
int
default_alloc
=
0
;
static
int
default_alloc
=
0
;
...
@@ -527,6 +527,27 @@ static int git_show_branch_config(const char *var, const char *value)
...
@@ -527,6 +527,27 @@ static int git_show_branch_config(const char *var, const char *value)
return
git_default_config
(
var
,
value
);
return
git_default_config
(
var
,
value
);
}
}
static
int
omit_in_dense
(
struct
commit
*
commit
,
struct
commit
**
rev
,
int
n
)
{
/* If the commit is tip of the named branches, do not
* omit it.
* Otherwise, if it is a merge that is reachable from only one
* tip, it is not that interesting.
*/
int
i
,
flag
,
count
;
for
(
i
=
0
;
i
<
n
;
i
++
)
if
(
rev
[
i
]
==
commit
)
return
0
;
flag
=
commit
->
object
.
flags
;
for
(
i
=
count
=
0
;
i
<
n
;
i
++
)
{
if
(
flag
&
(
1u
<<
(
i
+
REV_SHIFT
)))
count
++
;
}
if
(
count
==
1
)
return
1
;
return
0
;
}
int
main
(
int
ac
,
char
**
av
)
int
main
(
int
ac
,
char
**
av
)
{
{
struct
commit
*
rev
[
MAX_REVS
],
*
commit
;
struct
commit
*
rev
[
MAX_REVS
],
*
commit
;
...
@@ -548,6 +569,7 @@ int main(int ac, char **av)
...
@@ -548,6 +569,7 @@ int main(int ac, char **av)
int
with_current_branch
=
0
;
int
with_current_branch
=
0
;
int
head_at
=
-
1
;
int
head_at
=
-
1
;
int
topics
=
0
;
int
topics
=
0
;
int
dense
=
1
;
setup_git_directory
();
setup_git_directory
();
git_config
(
git_show_branch_config
);
git_config
(
git_show_branch_config
);
...
@@ -590,6 +612,8 @@ int main(int ac, char **av)
...
@@ -590,6 +612,8 @@ int main(int ac, char **av)
lifo
=
1
;
lifo
=
1
;
else
if
(
!
strcmp
(
arg
,
"--topics"
))
else
if
(
!
strcmp
(
arg
,
"--topics"
))
topics
=
1
;
topics
=
1
;
else
if
(
!
strcmp
(
arg
,
"--sparse"
))
dense
=
0
;
else
if
(
!
strcmp
(
arg
,
"--date-order"
))
else
if
(
!
strcmp
(
arg
,
"--date-order"
))
lifo
=
0
;
lifo
=
0
;
else
else
...
@@ -732,12 +756,15 @@ int main(int ac, char **av)
...
@@ -732,12 +756,15 @@ int main(int ac, char **av)
shown_merge_point
|=
is_merge_point
;
shown_merge_point
|=
is_merge_point
;
if
(
1
<
num_rev
)
{
if
(
1
<
num_rev
)
{
int
is_merge
=
!!
(
commit
->
parents
&&
commit
->
parents
->
next
);
int
is_merge
=
!!
(
commit
->
parents
&&
commit
->
parents
->
next
);
if
(
topics
&&
if
(
topics
&&
!
is_merge_point
&&
!
is_merge_point
&&
(
this_flag
&
(
1u
<<
REV_SHIFT
)))
(
this_flag
&
(
1u
<<
REV_SHIFT
)))
continue
;
continue
;
if
(
dense
&&
is_merge
&&
omit_in_dense
(
commit
,
rev
,
num_rev
))
continue
;
for
(
i
=
0
;
i
<
num_rev
;
i
++
)
{
for
(
i
=
0
;
i
<
num_rev
;
i
++
)
{
int
mark
;
int
mark
;
if
(
!
(
this_flag
&
(
1u
<<
(
i
+
REV_SHIFT
))))
if
(
!
(
this_flag
&
(
1u
<<
(
i
+
REV_SHIFT
))))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录