Skip to content

Commit 1b65a5a

Browse files
author
Junio C Hamano
committed
rev-list --boundary: show boundary commits even when limited otherwise.
The boundary commits are shown for UI like gitk to draw them as soon as topo-order sorting allows, and should not be omitted by get_revision() filtering logic. As long as their immediate child commits are shown, we should not filter them out. Signed-off-by: Junio C Hamano <[email protected]>
1 parent e6bfaf3 commit 1b65a5a

File tree

4 files changed

+36
-10
lines changed

4 files changed

+36
-10
lines changed

http-push.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ enum XML_Status {
6060
#define LOCK_TIME 600
6161
#define LOCK_REFRESH 30
6262

63-
/* bits #0-6 in revision.h */
63+
/* bits #0-15 in revision.h */
6464

65-
#define LOCAL (1u << 7)
66-
#define REMOTE (1u << 8)
67-
#define FETCHING (1u << 9)
68-
#define PUSHING (1u << 10)
65+
#define LOCAL (1u<<16)
66+
#define REMOTE (1u<<17)
67+
#define FETCHING (1u<<18)
68+
#define PUSHING (1u<<19)
6969

7070
/* We allow "recursive" symbolic refs. Only within reason, though */
7171
#define MAXDEPTH 5

rev-list.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
#include "diff.h"
99
#include "revision.h"
1010

11-
/* bits #0-6 in revision.h */
11+
/* bits #0-15 in revision.h */
1212

13-
#define COUNTED (1u<<7)
13+
#define COUNTED (1u<<16)
1414

1515
static const char rev_list_usage[] =
1616
"git-rev-list [OPTION] <commit-id>... [ -- paths... ]\n"

revision.c

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,17 @@ static void rewrite_parents(struct rev_info *revs, struct commit *commit)
750750
}
751751
}
752752

753+
static void mark_boundary_to_show(struct commit *commit)
754+
{
755+
struct commit_list *p = commit->parents;
756+
while (p) {
757+
commit = p->item;
758+
p = p->next;
759+
if (commit->object.flags & BOUNDARY)
760+
commit->object.flags |= BOUNDARY_SHOW;
761+
}
762+
}
763+
753764
struct commit *get_revision(struct rev_info *revs)
754765
{
755766
struct commit_list *list = revs->commits;
@@ -787,8 +798,20 @@ struct commit *get_revision(struct rev_info *revs)
787798
}
788799
if (commit->object.flags & SHOWN)
789800
continue;
790-
if (!(commit->object.flags & BOUNDARY) &&
791-
(commit->object.flags & UNINTERESTING))
801+
802+
/* We want to show boundary commits only when their
803+
* children are shown. When path-limiter is in effect,
804+
* rewrite_parents() drops some commits from getting shown,
805+
* and there is no point showing boundary parents that
806+
* are not shown. After rewrite_parents() rewrites the
807+
* parents of a commit that is shown, we mark the boundary
808+
* parents with BOUNDARY_SHOW.
809+
*/
810+
if (commit->object.flags & BOUNDARY_SHOW) {
811+
commit->object.flags |= SHOWN;
812+
return commit;
813+
}
814+
if (commit->object.flags & UNINTERESTING)
792815
continue;
793816
if (revs->min_age != -1 && (commit->date > revs->min_age))
794817
continue;
@@ -801,6 +824,8 @@ struct commit *get_revision(struct rev_info *revs)
801824
if (revs->parents)
802825
rewrite_parents(revs, commit);
803826
}
827+
if (revs->boundary)
828+
mark_boundary_to_show(commit);
804829
commit->object.flags |= SHOWN;
805830
return commit;
806831
} while (revs->commits);

revision.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
#define SHOWN (1u<<3)
88
#define TMP_MARK (1u<<4) /* for isolated cases; clean after use */
99
#define BOUNDARY (1u<<5)
10-
#define ADDED (1u<<6) /* Parents already parsed and added? */
10+
#define BOUNDARY_SHOW (1u<<6)
11+
#define ADDED (1u<<7) /* Parents already parsed and added? */
1112

1213
struct rev_info;
1314

0 commit comments

Comments
 (0)