Must be called only when object_name:filename doesn't exist. */
| 1608 | |
| 1609 | /* Must be called only when object_name:filename doesn't exist. */ |
| 1610 | static 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. */ |
| 1645 | static void diagnose_invalid_index_path(struct repository *r, |
no test coverage detected