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>
This commit is contained in:
Junio C Hamano 2006-04-16 18:12:49 -07:00
parent e6bfaf3e33
commit 1b65a5aa44
4 changed files with 36 additions and 10 deletions

View File

@ -60,12 +60,12 @@ enum XML_Status {
#define LOCK_TIME 600 #define LOCK_TIME 600
#define LOCK_REFRESH 30 #define LOCK_REFRESH 30
/* bits #0-6 in revision.h */ /* bits #0-15 in revision.h */
#define LOCAL (1u << 7) #define LOCAL (1u<<16)
#define REMOTE (1u << 8) #define REMOTE (1u<<17)
#define FETCHING (1u << 9) #define FETCHING (1u<<18)
#define PUSHING (1u << 10) #define PUSHING (1u<<19)
/* We allow "recursive" symbolic refs. Only within reason, though */ /* We allow "recursive" symbolic refs. Only within reason, though */
#define MAXDEPTH 5 #define MAXDEPTH 5

View File

@ -8,9 +8,9 @@
#include "diff.h" #include "diff.h"
#include "revision.h" #include "revision.h"
/* bits #0-6 in revision.h */ /* bits #0-15 in revision.h */
#define COUNTED (1u<<7) #define COUNTED (1u<<16)
static const char rev_list_usage[] = static const char rev_list_usage[] =
"git-rev-list [OPTION] <commit-id>... [ -- paths... ]\n" "git-rev-list [OPTION] <commit-id>... [ -- paths... ]\n"

View File

@ -750,6 +750,17 @@ static void rewrite_parents(struct rev_info *revs, struct commit *commit)
} }
} }
static void mark_boundary_to_show(struct commit *commit)
{
struct commit_list *p = commit->parents;
while (p) {
commit = p->item;
p = p->next;
if (commit->object.flags & BOUNDARY)
commit->object.flags |= BOUNDARY_SHOW;
}
}
struct commit *get_revision(struct rev_info *revs) struct commit *get_revision(struct rev_info *revs)
{ {
struct commit_list *list = revs->commits; struct commit_list *list = revs->commits;
@ -787,8 +798,20 @@ struct commit *get_revision(struct rev_info *revs)
} }
if (commit->object.flags & SHOWN) if (commit->object.flags & SHOWN)
continue; continue;
if (!(commit->object.flags & BOUNDARY) &&
(commit->object.flags & UNINTERESTING)) /* We want to show boundary commits only when their
* children are shown. When path-limiter is in effect,
* rewrite_parents() drops some commits from getting shown,
* and there is no point showing boundary parents that
* are not shown. After rewrite_parents() rewrites the
* parents of a commit that is shown, we mark the boundary
* parents with BOUNDARY_SHOW.
*/
if (commit->object.flags & BOUNDARY_SHOW) {
commit->object.flags |= SHOWN;
return commit;
}
if (commit->object.flags & UNINTERESTING)
continue; continue;
if (revs->min_age != -1 && (commit->date > revs->min_age)) if (revs->min_age != -1 && (commit->date > revs->min_age))
continue; continue;
@ -801,6 +824,8 @@ struct commit *get_revision(struct rev_info *revs)
if (revs->parents) if (revs->parents)
rewrite_parents(revs, commit); rewrite_parents(revs, commit);
} }
if (revs->boundary)
mark_boundary_to_show(commit);
commit->object.flags |= SHOWN; commit->object.flags |= SHOWN;
return commit; return commit;
} while (revs->commits); } while (revs->commits);

View File

@ -7,7 +7,8 @@
#define SHOWN (1u<<3) #define SHOWN (1u<<3)
#define TMP_MARK (1u<<4) /* for isolated cases; clean after use */ #define TMP_MARK (1u<<4) /* for isolated cases; clean after use */
#define BOUNDARY (1u<<5) #define BOUNDARY (1u<<5)
#define ADDED (1u<<6) /* Parents already parsed and added? */ #define BOUNDARY_SHOW (1u<<6)
#define ADDED (1u<<7) /* Parents already parsed and added? */
struct rev_info; struct rev_info;