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

Function diagnose_invalid_oid_path

object-name.c:1610–1642  ·  view source on GitHub ↗

Must be called only when object_name:filename doesn't exist. */

Source from the content-addressed store, hash-verified

1608
1609/* Must be called only when object_name:filename doesn't exist. */
1610static void diagnose_invalid_oid_path(struct repository *r,
1611 const char *prefix,
1612 const char *filename,
1613 const struct object_id *tree_oid,
1614 const char *object_name,
1615 int object_name_len)
1616{
1617 struct object_id oid;
1618 unsigned short mode;
1619
1620 if (!prefix)
1621 prefix = "";
1622
1623 if (file_exists(filename))
1624 die(_("path '%s' exists on disk, but not in '%.*s'"),
1625 filename, object_name_len, object_name);
1626 if (is_missing_file_error(errno)) {
1627 char *fullname = xstrfmt("%s%s", prefix, filename);
1628
1629 if (!get_tree_entry(r, tree_oid, fullname, &oid, &mode)) {
1630 die(_("path '%s' exists, but not '%s'\n"
1631 "hint: Did you mean '%.*s:%s' aka '%.*s:./%s'?"),
1632 fullname,
1633 filename,
1634 object_name_len, object_name,
1635 fullname,
1636 object_name_len, object_name,
1637 filename);
1638 }
1639 die(_("path '%s' does not exist in '%.*s'"),
1640 filename, object_name_len, object_name);
1641 }
1642}
1643
1644/* Must be called only when :stage:filename doesn't exist. */
1645static void diagnose_invalid_index_path(struct repository *r,

Callers 1

get_oid_with_context_1Function · 0.85

Calls 5

file_existsFunction · 0.85
is_missing_file_errorFunction · 0.85
xstrfmtFunction · 0.85
get_tree_entryFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected