summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e29cb53)
raw | patch | inline | side by side (parent: e29cb53)
author | Junio C Hamano <junkio@cox.net> | |
Tue, 19 Dec 2006 08:14:04 +0000 (00:14 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Thu, 21 Dec 2006 01:22:10 +0000 (17:22 -0800) |
This reasonably useful function was hidden inside builtin-branch.c
builtin-branch.c | patch | blob | history | |
commit.c | patch | blob | history | |
commit.h | patch | blob | history |
diff --git a/builtin-branch.c b/builtin-branch.c
index 903d5cf05600f9a7e297dc9450ad5980388072e9..745ee04d6e4a8f8b3ea96d35ec65d7a03d1441de 100644 (file)
--- a/builtin-branch.c
+++ b/builtin-branch.c
return "";
}
-static int in_merge_bases(const unsigned char *sha1,
- 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(sha1, b->item->object.sha1)) {
- ret = 1;
- break;
- }
- }
-
- free_commit_list(bases);
- return ret;
-}
-
static int delete_branches(int argc, const char **argv, int force, int kinds)
{
struct commit *rev, *head_rev = head_rev;
*/
if (!force &&
- !in_merge_bases(sha1, rev, head_rev)) {
+ !in_merge_bases(rev, head_rev)) {
error("The branch '%s' is not a strict subset of "
"your current HEAD.\n"
"If you are sure you want to delete it, "
diff --git a/commit.c b/commit.c
index 289ef65eb1162ff8f386bf31fa6ee27008bb3096..3167ce62acd5eb1076a4c089b54f2b37f821130b 100644 (file)
--- a/commit.c
+++ b/commit.c
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;
+}
diff --git a/commit.h b/commit.h
index fc13de9780f98c3bd9f330ef6177fd47a4da3d80..10eea9f26ff5db9df82245756c9c8bff0f6be3f6 100644 (file)
--- a/commit.h
+++ b/commit.h
extern struct commit_list *get_merge_bases(struct commit *rev1, struct commit *rev2, int cleanup);
+int in_merge_bases(struct commit *rev1, struct commit *rev2);
#endif /* COMMIT_H */