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 <junkio@cox.net>
Junio C Hamano committed
Apr 16, 2006 at 18:12 UTC
1b65a5aa449e2ea99a68f5d13c5521d0dc64dfd1
4 files changed
+36
-10
http-push.c
+5
-5
@@ -60,12 +60,12 @@ enum XML_Status {
60
#define LOCK_TIME 600
61
#define LOCK_REFRESH 30
62
63
-/* bits #0-6 in revision.h */
63
+/* bits #0-15 in revision.h */
64
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)
69
70
/* We allow "recursive" symbolic refs. Only within reason, though */
71
#define MAXDEPTH 5
rev-list.c
+2
-2
@@ -8,9 +8,9 @@
8
#include "diff.h"
9
#include "revision.h"
10
11
-/* bits #0-6 in revision.h */
11
+/* bits #0-15 in revision.h */
12
13
-#define COUNTED (1u<<7)
13
+#define COUNTED (1u<<16)
14
15
static const char rev_list_usage[] =
16
"git-rev-list [OPTION] <commit-id>... [ -- paths... ]\n"
revision.c
+27
-2
@@ -750,6 +750,17 @@ static void rewrite_parents(struct rev_info *revs, struct commit *commit)
750
}
751
}
752
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
+
764
struct commit *get_revision(struct rev_info *revs)
765
{
766
struct commit_list *list = revs->commits;
@@ -787,8 +798,20 @@ struct commit *get_revision(struct rev_info *revs)
798
}
799
if (commit->object.flags & SHOWN)
800
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)
815
continue;
816
if (revs->min_age != -1 && (commit->date > revs->min_age))
817
continue;
@@ -801,6 +824,8 @@ struct commit *get_revision(struct rev_info *revs)
824
if (revs->parents)
825
rewrite_parents(revs, commit);
826
}
827
+ if (revs->boundary)
828
+ mark_boundary_to_show(commit);
829
commit->object.flags |= SHOWN;
830
return commit;
831
} while (revs->commits);
revision.h
+2
-1
@@ -7,7 +7,8 @@
7
#define SHOWN (1u<<3)
8
#define TMP_MARK (1u<<4) /* for isolated cases; clean after use */
9
#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? */
12
13
struct rev_info;
14