From: "Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: szeder.dev@gmail.com, avarab@gmail.com,
abhishekkumar8222@gmail.com, me@ttaylorr.com,
Derrick Stolee <dstolee@microsoft.com>,
Derrick Stolee <dstolee@microsoft.com>
Subject: [PATCH 1/2] commit-reach: create repo_is_descendant_of()
Date: Wed, 17 Jun 2020 17:24:28 +0000 [thread overview]
Message-ID: <8f7fd8f5941426c3ed7fc28c6e4afd62bcd4bb8d.1592414670.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.664.git.1592414670.gitgitgadget@gmail.com>
From: Derrick Stolee <dstolee@microsoft.com>
The next change will make repo_in_merge_bases() depend on the logic in
is_descendant_of(), but we need to make the method independent of
the_repository first.
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
---
commit-reach.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/commit-reach.c b/commit-reach.c
index 4ca7e706a18..13722430aa5 100644
--- a/commit-reach.c
+++ b/commit-reach.c
@@ -283,7 +283,9 @@ struct commit_list *repo_get_merge_bases(struct repository *r,
/*
* Is "commit" a descendant of one of the elements on the "with_commit" list?
*/
-int is_descendant_of(struct commit *commit, struct commit_list *with_commit)
+static int repo_is_descendant_of(struct repository *r,
+ struct commit *commit,
+ struct commit_list *with_commit)
{
if (!with_commit)
return 1;
@@ -301,13 +303,18 @@ int is_descendant_of(struct commit *commit, struct commit_list *with_commit)
other = with_commit->item;
with_commit = with_commit->next;
- if (in_merge_bases(other, commit))
+ if (repo_in_merge_bases(r, other, commit))
return 1;
}
return 0;
}
}
+int is_descendant_of(struct commit *commit, struct commit_list *with_commit)
+{
+ return repo_is_descendant_of(the_repository, commit, with_commit);
+}
+
/*
* Is "commit" an ancestor of one of the "references"?
*/
--
gitgitgadget
next prev parent reply other threads:[~2020-06-17 17:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-17 17:24 [PATCH 0/2] Accelerate "git merge-base --is-ancestor" Derrick Stolee via GitGitGadget
2020-06-17 17:24 ` Derrick Stolee via GitGitGadget [this message]
2020-06-29 13:40 ` [PATCH 1/2] commit-reach: create repo_is_descendant_of() Taylor Blau
2020-06-30 1:45 ` Derrick Stolee
2020-06-17 17:24 ` [PATCH 2/2] commit-reach: use fast logic in repo_in_merge_base Derrick Stolee via GitGitGadget
2020-06-17 20:46 ` [PATCH 0/2] Accelerate "git merge-base --is-ancestor" Junio C Hamano
2020-06-18 1:37 ` Derrick Stolee
2020-06-19 6:10 ` Abhishek Kumar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8f7fd8f5941426c3ed7fc28c6e4afd62bcd4bb8d.1592414670.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=abhishekkumar8222@gmail.com \
--cc=avarab@gmail.com \
--cc=dstolee@microsoft.com \
--cc=git@vger.kernel.org \
--cc=me@ttaylorr.com \
--cc=szeder.dev@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).