@@ -211,6 +211,9 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
211
211
quote_path (path -> buf , prefix , & quoted , 0 );
212
212
errno = saved_errno ;
213
213
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
+ }
214
217
* dir_gone = 0 ;
215
218
}
216
219
ret = res ;
@@ -246,6 +249,9 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
246
249
quote_path (path -> buf , prefix , & quoted , 0 );
247
250
errno = saved_errno ;
248
251
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
+ }
249
255
* dir_gone = 0 ;
250
256
ret = 1 ;
251
257
}
@@ -289,6 +295,9 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
289
295
quote_path (path -> buf , prefix , & quoted , 0 );
290
296
errno = saved_errno ;
291
297
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
+ }
292
301
* dir_gone = 0 ;
293
302
ret = 1 ;
294
303
}
@@ -1108,6 +1117,9 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
1108
1117
qname = quote_path (item -> string , NULL , & buf , 0 );
1109
1118
errno = saved_errno ;
1110
1119
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
+ }
1111
1123
errors ++ ;
1112
1124
} else if (!quiet ) {
1113
1125
qname = quote_path (item -> string , NULL , & buf , 0 );
0 commit comments