|
25 | 25 | #include "pathspec.h"
|
26 | 26 | #include "help.h"
|
27 | 27 | #include "prompt.h"
|
| 28 | +#include "advice.h" |
28 | 29 |
|
29 | 30 | static int require_force = -1; /* unset */
|
30 | 31 | static int interactive;
|
@@ -220,6 +221,9 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
|
220 | 221 | quote_path(path->buf, prefix, "ed, 0);
|
221 | 222 | errno = saved_errno;
|
222 | 223 | warning_errno(_(msg_warn_remove_failed), quoted.buf);
|
| 224 | + if (saved_errno == ENAMETOOLONG) { |
| 225 | + advise_if_enabled(ADVICE_NAME_TOO_LONG, _("Setting `core.longPaths` may allow the deletion to succeed.")); |
| 226 | + } |
223 | 227 | *dir_gone = 0;
|
224 | 228 | }
|
225 | 229 | ret = res;
|
@@ -255,6 +259,9 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
|
255 | 259 | quote_path(path->buf, prefix, "ed, 0);
|
256 | 260 | errno = saved_errno;
|
257 | 261 | warning_errno(_(msg_warn_remove_failed), quoted.buf);
|
| 262 | + if (saved_errno == ENAMETOOLONG) { |
| 263 | + advise_if_enabled(ADVICE_NAME_TOO_LONG, _("Setting `core.longPaths` may allow the deletion to succeed.")); |
| 264 | + } |
258 | 265 | *dir_gone = 0;
|
259 | 266 | ret = 1;
|
260 | 267 | }
|
@@ -298,6 +305,9 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
|
298 | 305 | quote_path(path->buf, prefix, "ed, 0);
|
299 | 306 | errno = saved_errno;
|
300 | 307 | warning_errno(_(msg_warn_remove_failed), quoted.buf);
|
| 308 | + if (saved_errno == ENAMETOOLONG) { |
| 309 | + advise_if_enabled(ADVICE_NAME_TOO_LONG, _("Setting `core.longPaths` may allow the deletion to succeed.")); |
| 310 | + } |
301 | 311 | *dir_gone = 0;
|
302 | 312 | ret = 1;
|
303 | 313 | }
|
@@ -1110,6 +1120,9 @@ int cmd_clean(int argc,
|
1110 | 1120 | qname = quote_path(item->string, NULL, &buf, 0);
|
1111 | 1121 | errno = saved_errno;
|
1112 | 1122 | warning_errno(_(msg_warn_remove_failed), qname);
|
| 1123 | + if (saved_errno == ENAMETOOLONG) { |
| 1124 | + advise_if_enabled(ADVICE_NAME_TOO_LONG, _("Setting `core.longPaths` may allow the deletion to succeed.")); |
| 1125 | + } |
1113 | 1126 | errors++;
|
1114 | 1127 | } else if (!quiet) {
|
1115 | 1128 | qname = quote_path(item->string, NULL, &buf, 0);
|
|
0 commit comments