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

Function ref_transaction_rejection_handler

builtin/fetch.c:1811–1851  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1809};
1810
1811static void ref_transaction_rejection_handler(const char *refname,
1812 const struct object_id *old_oid UNUSED,
1813 const struct object_id *new_oid UNUSED,
1814 const char *old_target UNUSED,
1815 const char *new_target UNUSED,
1816 enum ref_transaction_error err,
1817 const char *details,
1818 void *cb_data)
1819{
1820 struct ref_rejection_data *data = cb_data;
1821
1822 if (err == REF_TRANSACTION_ERROR_CASE_CONFLICT && ignore_case &&
1823 !data->case_sensitive_msg_shown) {
1824 error(_("You're on a case-insensitive filesystem, and the remote you are\n"
1825 "trying to fetch from has references that only differ in casing. It\n"
1826 "is impossible to store such references with the 'files' backend. You\n"
1827 "can either accept this as-is, in which case you won't be able to\n"
1828 "store all remote references on disk. Or you can alternatively\n"
1829 "migrate your repository to use the 'reftable' backend with the\n"
1830 "following command:\n\n git refs migrate --ref-format=reftable\n\n"
1831 "Please keep in mind that not all implementations of Git support this\n"
1832 "new format yet. So if you use tools other than Git to access this\n"
1833 "repository it may not be an option to migrate to reftables.\n"));
1834 data->case_sensitive_msg_shown = true;
1835 } else if (err == REF_TRANSACTION_ERROR_NAME_CONFLICT &&
1836 !data->conflict_msg_shown) {
1837 error(_("some local refs could not be updated; try running\n"
1838 " 'git remote prune %s' to remove any old, conflicting "
1839 "branches"), data->remote_name);
1840 data->conflict_msg_shown = true;
1841 } else {
1842 if (details)
1843 error("%s", details);
1844 else
1845 error(_("fetching ref %s failed: %s"),
1846 refname, ref_transaction_error_msg(err));
1847 }
1848
1849 strmap_put(data->rejected_refs, refname, NULL);
1850 *data->retcode = 1;
1851}
1852
1853/*
1854 * Commit the reference transaction. If it isn't an atomic transaction, handle

Callers

nothing calls this directly

Calls 3

errorFunction · 0.85
strmap_putFunction · 0.85

Tested by

no test coverage detected