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

Function infer_range_diff_ranges

builtin/log.c:1930–1952  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1928}
1929
1930static void infer_range_diff_ranges(struct strbuf *r1,
1931 struct strbuf *r2,
1932 const char *prev,
1933 struct commit *origin,
1934 struct commit *head)
1935{
1936 const char *head_oid = oid_to_hex(&head->object.oid);
1937 int prev_is_range = is_range_diff_range(prev);
1938
1939 if (prev_is_range)
1940 strbuf_addstr(r1, prev);
1941 else
1942 strbuf_addf(r1, "%s..%s", head_oid, prev);
1943
1944 if (origin)
1945 strbuf_addf(r2, "%s..%s", oid_to_hex(&origin->object.oid), head_oid);
1946 else if (prev_is_range)
1947 die(_("failed to infer range-diff origin of current series"));
1948 else {
1949 warning(_("using '%s' as range-diff origin of current series"), prev);
1950 strbuf_addf(r2, "%s..%s", prev, head_oid);
1951 }
1952}
1953
1954int cmd_format_patch(int argc,
1955 const char **argv,

Callers 1

cmd_format_patchFunction · 0.85

Calls 6

oid_to_hexFunction · 0.85
is_range_diff_rangeFunction · 0.85
strbuf_addstrFunction · 0.85
strbuf_addfFunction · 0.85
warningFunction · 0.85
dieFunction · 0.50

Tested by

no test coverage detected