Merge commit '079f7cb27b6636f9153c24a82f3d5d74a7b0b6b1'

Some topics were reverted in Junio's 'next'. Since this port was started
from 'next' while these topics were still in 'next', but was later changed
to pull in only master, these reversals were missed. This takes care of
this omission.
This commit is contained in:
Johannes Sixt
2007-05-19 21:57:41 +02:00
3 changed files with 28 additions and 106 deletions

View File

@@ -1263,10 +1263,25 @@ static struct commit *interesting(struct commit_list *list)
return NULL;
}
static struct commit_list *base_traverse(struct commit_list *list, struct commit *stop)
static struct commit_list *merge_bases(struct commit *one, struct commit *two)
{
struct commit_list *list = NULL;
struct commit_list *result = NULL;
if (one == two)
/* We do not mark this even with RESULT so we do not
* have to clean it up.
*/
return commit_list_insert(one, &result);
parse_commit(one);
parse_commit(two);
one->object.flags |= PARENT1;
two->object.flags |= PARENT2;
insert_by_date(one, &list);
insert_by_date(two, &list);
while (interesting(list)) {
struct commit *commit;
struct commit_list *parents;
@@ -1297,20 +1312,10 @@ static struct commit_list *base_traverse(struct commit_list *list, struct commit
p->object.flags |= flags;
insert_by_date(p, &list);
}
if (stop && (stop->object.flags & PARENT2)) {
free_commit_list(list);
list = NULL;
insert_by_date(stop, &list);
return list;
}
}
/* Clean up the result to remove stale ones */
free_commit_list(list);
if (stop)
return NULL;
list = result; result = NULL;
while (list) {
struct commit_list *n = list->next;
@@ -1322,27 +1327,6 @@ static struct commit_list *base_traverse(struct commit_list *list, struct commit
return result;
}
static struct commit_list *merge_bases(struct commit *one, struct commit *two)
{
struct commit_list *list = NULL;
if (one == two)
/* We do not mark this even with RESULT so we do not
* have to clean it up.
*/
return commit_list_insert(one, &list);
parse_commit(one);
parse_commit(two);
one->object.flags |= PARENT1;
two->object.flags |= PARENT2;
insert_by_date(one, &list);
insert_by_date(two, &list);
return base_traverse(list, NULL);
}
struct commit_list *get_merge_bases(struct commit *one,
struct commit *two,
int cleanup)
@@ -1405,30 +1389,20 @@ struct commit_list *get_merge_bases(struct commit *one,
int in_merge_bases(struct commit *commit, struct commit **reference, int num)
{
struct commit_list *result, *list;
int i, ret;
struct commit_list *bases, *b;
int ret = 0;
list = NULL;
parse_commit(commit);
commit->object.flags |= PARENT1;
insert_by_date(commit, &list);
for (i = 0; i < num; i++) {
struct commit *two = reference[i];
parse_commit(two);
if (!(two->object.flags & PARENT2)) {
two->object.flags |= PARENT2;
insert_by_date(two, &list);
if (num == 1)
bases = get_merge_bases(commit, *reference, 1);
else
die("not yet");
for (b = bases; b; b = b->next) {
if (!hashcmp(commit->object.sha1, b->item->object.sha1)) {
ret = 1;
break;
}
}
result = base_traverse(list, commit);
ret = !!result;
free_commit_list(result);
clear_commit_marks(commit, all_flags);
for (i = 0; i < num; i++) {
struct commit *two = reference[i];
clear_commit_marks(two, all_flags);
}
free_commit_list(bases);
return ret;
}