revision: do not include sibling history in --ancestry-path output
If the commit specified as the bottom of the commit range has a direct parent that has another child commit that contributed to the resulting history, "rev-list --ancestry-path" was confused and listed that side history as well, due to the command line parser subtlety corrected by the previous commit. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
281eee4730
commit
c3502fa882
16
revision.c
16
revision.c
@ -724,12 +724,16 @@ static void limit_to_ancestry(struct commit_list *bottom, struct commit_list *li
|
|||||||
* to filter the result of "A..B" further to the ones that can actually
|
* to filter the result of "A..B" further to the ones that can actually
|
||||||
* reach A.
|
* reach A.
|
||||||
*/
|
*/
|
||||||
static struct commit_list *collect_bottom_commits(struct commit_list *list)
|
static struct commit_list *collect_bottom_commits(struct rev_info *revs)
|
||||||
{
|
{
|
||||||
struct commit_list *elem, *bottom = NULL;
|
struct commit_list *bottom = NULL;
|
||||||
for (elem = list; elem; elem = elem->next)
|
int i;
|
||||||
if (elem->item->object.flags & UNINTERESTING)
|
for (i = 0; i < revs->cmdline.nr; i++) {
|
||||||
commit_list_insert(elem->item, &bottom);
|
struct rev_cmdline_entry *elem = &revs->cmdline.rev[i];
|
||||||
|
if ((elem->flags & UNINTERESTING) &&
|
||||||
|
elem->item->type == OBJ_COMMIT)
|
||||||
|
commit_list_insert((struct commit *)elem->item, &bottom);
|
||||||
|
}
|
||||||
return bottom;
|
return bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -743,7 +747,7 @@ static int limit_list(struct rev_info *revs)
|
|||||||
struct commit_list *bottom = NULL;
|
struct commit_list *bottom = NULL;
|
||||||
|
|
||||||
if (revs->ancestry_path) {
|
if (revs->ancestry_path) {
|
||||||
bottom = collect_bottom_commits(list);
|
bottom = collect_bottom_commits(revs);
|
||||||
if (!bottom)
|
if (!bottom)
|
||||||
die("--ancestry-path given but there are no bottom commits");
|
die("--ancestry-path given but there are no bottom commits");
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ test_expect_success 'criss-cross: rev-list --ancestry-path cb..bc' '
|
|||||||
'
|
'
|
||||||
|
|
||||||
# no commits in repository descend from cb
|
# no commits in repository descend from cb
|
||||||
test_expect_failure 'criss-cross: rev-list --ancestry-path --all ^cb' '
|
test_expect_success 'criss-cross: rev-list --ancestry-path --all ^cb' '
|
||||||
(cd criss-cross &&
|
(cd criss-cross &&
|
||||||
git rev-list --ancestry-path --all ^cb > actual &&
|
git rev-list --ancestry-path --all ^cb > actual &&
|
||||||
test -z "$(cat actual)")
|
test -z "$(cat actual)")
|
||||||
|
Loading…
Reference in New Issue
Block a user