Merge branch 'jc/fsck-reflog' into next

* jc/fsck-reflog:
  git reflog expire
  Move in_merge_bases() to commit.c
  reflog: fix warning message.
  Teach git-repack to preserve objects referred to by reflog entries.
  Protect commits recorded in reflog from pruning.
  add for_each_reflog_ent() iterator
  diff documentation: mostly talk about <commit>
  compat/inet_ntop: do not use u_int
  git-add: error out when given no arguments.

Conflicts:

	commit.h
This commit is contained in:
Junio C Hamano
2006-12-20 17:22:34 -08:00
17 changed files with 333 additions and 35 deletions

View File

@@ -1043,3 +1043,20 @@ struct commit_list *get_merge_bases(struct commit *one,
free(rslt);
return result;
}
int in_merge_bases(struct commit *rev1, struct commit *rev2)
{
struct commit_list *bases, *b;
int ret = 0;
bases = get_merge_bases(rev1, rev2, 1);
for (b = bases; b; b = b->next) {
if (!hashcmp(rev1->object.sha1, b->item->object.sha1)) {
ret = 1;
break;
}
}
free_commit_list(bases);
return ret;
}