@@ -211,6 +211,9 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
211211 quote_path (path -> buf , prefix , & quoted , 0 );
212212 errno = saved_errno ;
213213 warning_errno (_ (msg_warn_remove_failed ), quoted .buf );
214+ if (saved_errno == ENAMETOOLONG ) {
215+ advise_if_enabled (ADVICE_NAME_TOO_LONG , _ ("Setting `core.longPaths` may allow the deletion to succeed." ));
216+ }
214217 * dir_gone = 0 ;
215218 }
216219 ret = res ;
@@ -246,6 +249,9 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
246249 quote_path (path -> buf , prefix , & quoted , 0 );
247250 errno = saved_errno ;
248251 warning_errno (_ (msg_warn_remove_failed ), quoted .buf );
252+ if (saved_errno == ENAMETOOLONG ) {
253+ advise_if_enabled (ADVICE_NAME_TOO_LONG , _ ("Setting `core.longPaths` may allow the deletion to succeed." ));
254+ }
249255 * dir_gone = 0 ;
250256 ret = 1 ;
251257 }
@@ -289,6 +295,9 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
289295 quote_path (path -> buf , prefix , & quoted , 0 );
290296 errno = saved_errno ;
291297 warning_errno (_ (msg_warn_remove_failed ), quoted .buf );
298+ if (saved_errno == ENAMETOOLONG ) {
299+ advise_if_enabled (ADVICE_NAME_TOO_LONG , _ ("Setting `core.longPaths` may allow the deletion to succeed." ));
300+ }
292301 * dir_gone = 0 ;
293302 ret = 1 ;
294303 }
@@ -1108,6 +1117,9 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
11081117 qname = quote_path (item -> string , NULL , & buf , 0 );
11091118 errno = saved_errno ;
11101119 warning_errno (_ (msg_warn_remove_failed ), qname );
1120+ if (saved_errno == ENAMETOOLONG ) {
1121+ advise_if_enabled (ADVICE_NAME_TOO_LONG , _ ("Setting `core.longPaths` may allow the deletion to succeed." ));
1122+ }
11111123 errors ++ ;
11121124 } else if (!quiet ) {
11131125 qname = quote_path (item -> string , NULL , & buf , 0 );
0 commit comments