Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
git-log --first-parent: show only the first parent log
author
Junio C Hamano
<junkio@cox.net>
Tue, 13 Mar 2007 08:57:22 +0000
(
01:57
-0700)
committer
Junio C Hamano
<junkio@cox.net>
Wed, 14 Mar 2007 23:22:18 +0000
(16:22 -0700)
If your development history does not have fast-forward merges,
i.e. the "first parent" of commits in your history are special
than other parents, this option gives a better overview of the
evolution of a particular branch.
Signed-off-by: Junio C Hamano <junkio@cox.net>
revision.c
patch
|
blob
|
history
revision.h
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
803527f
)
diff --git
a/revision.c
b/revision.c
index 3c2eb125e6e9332fe32be9bcec6fb2005228c211..8afc1968470c88827a2c3da05ece345520b2d336 100644
(file)
--- a/
revision.c
+++ b/
revision.c
@@
-350,6
+350,7
@@
static void add_parents_to_list(struct rev_info *revs, struct commit *commit, st
{
struct commit_list *parent = commit->parents;
unsigned left_flag;
{
struct commit_list *parent = commit->parents;
unsigned left_flag;
+ int add, rest;
if (commit->object.flags & ADDED)
return;
if (commit->object.flags & ADDED)
return;
@@
-395,18
+396,19
@@
static void add_parents_to_list(struct rev_info *revs, struct commit *commit, st
return;
left_flag = (commit->object.flags & SYMMETRIC_LEFT);
return;
left_flag = (commit->object.flags & SYMMETRIC_LEFT);
- parent = commit->parents;
- while (parent) {
+
+ rest = !revs->first_parent_only;
+ for (parent = commit->parents, add = 1; parent; add = rest) {
struct commit *p = parent->item;
parent = parent->next;
struct commit *p = parent->item;
parent = parent->next;
-
parse_commit(p);
p->object.flags |= left_flag;
if (p->object.flags & SEEN)
continue;
p->object.flags |= SEEN;
parse_commit(p);
p->object.flags |= left_flag;
if (p->object.flags & SEEN)
continue;
p->object.flags |= SEEN;
- insert_by_date(p, list);
+ if (add)
+ insert_by_date(p, list);
}
}
}
}
@@
-836,6
+838,10
@@
int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
handle_all(revs, flags);
continue;
}
handle_all(revs, flags);
continue;
}
+ if (!strcmp(arg, "--first-parent")) {
+ revs->first_parent_only = 1;
+ continue;
+ }
if (!strcmp(arg, "--reflog")) {
handle_reflog(revs, flags);
continue;
if (!strcmp(arg, "--reflog")) {
handle_reflog(revs, flags);
continue;
diff --git
a/revision.h
b/revision.h
index 6ae39e6bec180769df0bccccdf652ad0ffd784f0..55e6b531ce3e5838f988ca1896484333e795f192 100644
(file)
--- a/
revision.h
+++ b/
revision.h
@@
-46,7
+46,8
@@
struct rev_info {
boundary:2,
left_right:1,
parents:1,
boundary:2,
left_right:1,
parents:1,
- reverse:1;
+ reverse:1,
+ first_parent_only:1;
/* Diff flags */
unsigned int diff:1,
/* Diff flags */
unsigned int diff:1,