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