MCPcopy Create free account
hub / github.com/git/git / add_parents_only

Function add_parents_only

revision.c:1888–1932  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1886}
1887
1888static int add_parents_only(struct rev_info *revs, const char *arg_, int flags,
1889 int exclude_parent)
1890{
1891 struct object_id oid;
1892 struct object *it;
1893 struct commit *commit;
1894 struct commit_list *parents;
1895 int parent_number;
1896 const char *arg = arg_;
1897
1898 if (*arg == '^') {
1899 flags ^= UNINTERESTING | BOTTOM;
1900 arg++;
1901 }
1902 if (repo_get_oid_committish(the_repository, arg, &oid))
1903 return 0;
1904 while (1) {
1905 it = get_reference(revs, arg, &oid, 0);
1906 if (!it && revs->ignore_missing)
1907 return 0;
1908 if (it->type != OBJ_TAG)
1909 break;
1910 if (!((struct tag*)it)->tagged)
1911 return 0;
1912 oidcpy(&oid, &((struct tag*)it)->tagged->oid);
1913 }
1914 if (it->type != OBJ_COMMIT)
1915 return 0;
1916 commit = (struct commit *)it;
1917 if (exclude_parent &&
1918 exclude_parent > commit_list_count(commit->parents))
1919 return 0;
1920 for (parents = commit->parents, parent_number = 1;
1921 parents;
1922 parents = parents->next, parent_number++) {
1923 if (exclude_parent && parent_number != exclude_parent)
1924 continue;
1925
1926 it = &parents->item->object;
1927 it->flags |= flags;
1928 add_rev_cmdline(revs, it, arg_, REV_CMD_PARENTS_ONLY, flags);
1929 add_pending_object(revs, it, arg);
1930 }
1931 return 1;
1932}
1933
1934void repo_init_revisions(struct repository *r,
1935 struct rev_info *revs,

Callers 1

handle_revision_arg_1Function · 0.85

Calls 6

repo_get_oid_committishFunction · 0.85
get_referenceFunction · 0.85
oidcpyFunction · 0.85
commit_list_countFunction · 0.85
add_rev_cmdlineFunction · 0.85
add_pending_objectFunction · 0.85

Tested by

no test coverage detected