@@ -1643,7 +1643,8 @@ static int set_head(const struct ref *remote_refs, struct remote *remote)
16431643
16441644struct ref_rejection_data {
16451645 int * retcode ;
1646- int conflict_msg_shown ;
1646+ bool conflict_msg_shown ;
1647+ bool case_sensitive_msg_shown ;
16471648 const char * remote_name ;
16481649};
16491650
@@ -1657,11 +1658,25 @@ static void ref_transaction_rejection_handler(const char *refname,
16571658{
16581659 struct ref_rejection_data * data = cb_data ;
16591660
1660- if (err == REF_TRANSACTION_ERROR_NAME_CONFLICT && !data -> conflict_msg_shown ) {
1661+ if (err == REF_TRANSACTION_ERROR_CREATE_EXISTS && ignore_case &&
1662+ !data -> case_sensitive_msg_shown ) {
1663+ error (_ ("You're on a case-insensitive filesystem, and the remote you are\n"
1664+ "trying to fetch from has references that only differ in casing. It\n"
1665+ "is impossible to store such references with the 'files' backend. You\n"
1666+ "can either accept this as-is, in which case you won't be able to\n"
1667+ "store all remote references on disk. Or you can alternatively\n"
1668+ "migrate your repository to use the 'reftable' backend with the\n"
1669+ "following command:\n\n git refs migrate --ref-format=reftable\n\n"
1670+ "Please keep in mind that not all implementations of Git support this\n"
1671+ "new format yet. So if you use tools other than Git to access this\n"
1672+ "repository it may not be an option to migrate to reftables.\n" ));
1673+ data -> case_sensitive_msg_shown = true;
1674+ } else if (err == REF_TRANSACTION_ERROR_NAME_CONFLICT &&
1675+ !data -> conflict_msg_shown ) {
16611676 error (_ ("some local refs could not be updated; try running\n"
16621677 " 'git remote prune %s' to remove any old, conflicting "
16631678 "branches" ), data -> remote_name );
1664- data -> conflict_msg_shown = 1 ;
1679+ data -> conflict_msg_shown = true ;
16651680 } else {
16661681 const char * reason = ref_transaction_error_msg (err );
16671682
0 commit comments