|
22 | 22 | #include "pathspec.h"
|
23 | 23 | #include "help.h"
|
24 | 24 | #include "prompt.h"
|
| 25 | +#include "advice.h" |
25 | 26 |
|
26 | 27 | static int require_force = -1; /* unset */
|
27 | 28 | static int interactive;
|
@@ -217,6 +218,9 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
|
217 | 218 | quote_path(path->buf, prefix, "ed, 0);
|
218 | 219 | errno = saved_errno;
|
219 | 220 | warning_errno(_(msg_warn_remove_failed), quoted.buf);
|
| 221 | + if (saved_errno == ENAMETOOLONG) { |
| 222 | + advise_if_enabled(ADVICE_NAME_TOO_LONG, _("Setting `core.longPaths` may allow the deletion to succeed.")); |
| 223 | + } |
220 | 224 | *dir_gone = 0;
|
221 | 225 | }
|
222 | 226 | ret = res;
|
@@ -252,6 +256,9 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
|
252 | 256 | quote_path(path->buf, prefix, "ed, 0);
|
253 | 257 | errno = saved_errno;
|
254 | 258 | warning_errno(_(msg_warn_remove_failed), quoted.buf);
|
| 259 | + if (saved_errno == ENAMETOOLONG) { |
| 260 | + advise_if_enabled(ADVICE_NAME_TOO_LONG, _("Setting `core.longPaths` may allow the deletion to succeed.")); |
| 261 | + } |
255 | 262 | *dir_gone = 0;
|
256 | 263 | ret = 1;
|
257 | 264 | }
|
@@ -295,6 +302,9 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
|
295 | 302 | quote_path(path->buf, prefix, "ed, 0);
|
296 | 303 | errno = saved_errno;
|
297 | 304 | warning_errno(_(msg_warn_remove_failed), quoted.buf);
|
| 305 | + if (saved_errno == ENAMETOOLONG) { |
| 306 | + advise_if_enabled(ADVICE_NAME_TOO_LONG, _("Setting `core.longPaths` may allow the deletion to succeed.")); |
| 307 | + } |
298 | 308 | *dir_gone = 0;
|
299 | 309 | ret = 1;
|
300 | 310 | }
|
@@ -1107,6 +1117,9 @@ int cmd_clean(int argc,
|
1107 | 1117 | qname = quote_path(item->string, NULL, &buf, 0);
|
1108 | 1118 | errno = saved_errno;
|
1109 | 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 | + } |
1110 | 1123 | errors++;
|
1111 | 1124 | } else if (!quiet) {
|
1112 | 1125 | qname = quote_path(item->string, NULL, &buf, 0);
|
|
0 commit comments