| 2049 | } |
| 2050 | |
| 2051 | static int handle_dotdot_1(const char *a_name, const char *b_name, |
| 2052 | const char *full_name, int symmetric, |
| 2053 | struct rev_info *revs, int flags, |
| 2054 | int cant_be_filename, |
| 2055 | struct object_context *a_oc, |
| 2056 | struct object_context *b_oc) |
| 2057 | { |
| 2058 | struct object_id a_oid, b_oid; |
| 2059 | struct object *a_obj, *b_obj; |
| 2060 | unsigned int a_flags, b_flags; |
| 2061 | unsigned int flags_exclude = flags ^ (UNINTERESTING | BOTTOM); |
| 2062 | unsigned int oc_flags = GET_OID_COMMITTISH | GET_OID_RECORD_PATH; |
| 2063 | |
| 2064 | if (!*a_name) |
| 2065 | a_name = "HEAD"; |
| 2066 | |
| 2067 | if (!*b_name) |
| 2068 | b_name = "HEAD"; |
| 2069 | |
| 2070 | if (get_oid_with_context(revs->repo, a_name, oc_flags, &a_oid, a_oc) || |
| 2071 | get_oid_with_context(revs->repo, b_name, oc_flags, &b_oid, b_oc)) |
| 2072 | return -1; |
| 2073 | |
| 2074 | if (!cant_be_filename) { |
| 2075 | verify_non_filename(the_repository, revs->prefix, full_name); |
| 2076 | } |
| 2077 | |
| 2078 | a_obj = parse_object(revs->repo, &a_oid); |
| 2079 | b_obj = parse_object(revs->repo, &b_oid); |
| 2080 | if (!a_obj || !b_obj) |
| 2081 | return dotdot_missing(full_name, revs, symmetric); |
| 2082 | |
| 2083 | if (!symmetric) { |
| 2084 | /* just A..B */ |
| 2085 | b_flags = flags; |
| 2086 | a_flags = flags_exclude; |
| 2087 | } else { |
| 2088 | /* A...B -- find merge bases between the two */ |
| 2089 | struct commit *a, *b; |
| 2090 | struct commit_list *exclude = NULL; |
| 2091 | |
| 2092 | a = lookup_commit_reference(revs->repo, &a_obj->oid); |
| 2093 | b = lookup_commit_reference(revs->repo, &b_obj->oid); |
| 2094 | if (!a || !b) |
| 2095 | return dotdot_missing(full_name, revs, symmetric); |
| 2096 | |
| 2097 | if (repo_get_merge_bases(the_repository, a, b, &exclude) < 0) { |
| 2098 | commit_list_free(exclude); |
| 2099 | return -1; |
| 2100 | } |
| 2101 | add_rev_cmdline_list(revs, exclude, REV_CMD_MERGE_BASE, |
| 2102 | flags_exclude); |
| 2103 | add_pending_commit_list(revs, exclude, flags_exclude); |
| 2104 | commit_list_free(exclude); |
| 2105 | |
| 2106 | b_flags = flags; |
| 2107 | a_flags = flags | SYMMETRIC_LEFT; |
| 2108 | } |
no test coverage detected