summaryrefslogtreecommitdiff
path: root/shallow.c
diff options
context:
space:
mode:
authorJerry Zhang <jerry@skydio.com>2022-01-11 21:39:41 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-01-12 19:08:42 (GMT)
commit9d505b7b49c00c5fa99a25506e63a2ef326a0062 (patch)
treeebb11a579cd85400317a4d6477b8d5f5c0c5e62a /shallow.c
parent90d242d36e248acfae0033274b524bfa55a947fd (diff)
downloadgit-9d505b7b49c00c5fa99a25506e63a2ef326a0062.zip
git-9d505b7b49c00c5fa99a25506e63a2ef326a0062.tar.gz
git-9d505b7b49c00c5fa99a25506e63a2ef326a0062.tar.bz2
git-rev-list: add --exclude-first-parent-only flag
It is useful to know when a branch first diverged in history from some integration branch in order to be able to enumerate the user's local changes. However, these local changes can include arbitrary merges, so it is necessary to ignore this merge structure when finding the divergence point. In order to do this, teach the "rev-list" family to accept "--exclude-first-parent-only", which restricts the traversal of excluded commits to only follow first parent links. -A-----E-F-G--main \ / / B-C-D--topic In this example, the goal is to return the set {B, C, D} which represents a topic branch that has been merged into main branch. `git rev-list topic ^main` will end up returning no commits since excluding main will end up traversing the commits on topic as well. `git rev-list --exclude-first-parent-only topic ^main` however will return {B, C, D} as desired. Add docs for the new flag, and clarify the doc for --first-parent to indicate that it applies to traversing the set of included commits only. Signed-off-by: Jerry Zhang <jerry@skydio.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'shallow.c')
-rw-r--r--shallow.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/shallow.c b/shallow.c
index 9ed18eb..71e5876 100644
--- a/shallow.c
+++ b/shallow.c
@@ -603,7 +603,7 @@ static int mark_uninteresting(const char *refname, const struct object_id *oid,
if (!commit)
return 0;
commit->object.flags |= UNINTERESTING;
- mark_parents_uninteresting(commit);
+ mark_parents_uninteresting(NULL, commit);
return 0;
}