|
24 | 24 | #include "pathspec.h" |
25 | 25 | #include "help.h" |
26 | 26 | #include "prompt.h" |
| 27 | +#include "advice.h" |
27 | 28 |
|
28 | 29 | static int force = -1; /* unset */ |
29 | 30 | static int interactive; |
@@ -219,6 +220,9 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag, |
219 | 220 | quote_path(path->buf, prefix, "ed, 0); |
220 | 221 | errno = saved_errno; |
221 | 222 | warning_errno(_(msg_warn_remove_failed), quoted.buf); |
| 223 | + if (saved_errno == ENAMETOOLONG) { |
| 224 | + advise_if_enabled(ADVICE_NAME_TOO_LONG, _("Setting `core.longPaths` may allow the deletion to succeed.")); |
| 225 | + } |
222 | 226 | *dir_gone = 0; |
223 | 227 | } |
224 | 228 | ret = res; |
@@ -254,6 +258,9 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag, |
254 | 258 | quote_path(path->buf, prefix, "ed, 0); |
255 | 259 | errno = saved_errno; |
256 | 260 | warning_errno(_(msg_warn_remove_failed), quoted.buf); |
| 261 | + if (saved_errno == ENAMETOOLONG) { |
| 262 | + advise_if_enabled(ADVICE_NAME_TOO_LONG, _("Setting `core.longPaths` may allow the deletion to succeed.")); |
| 263 | + } |
257 | 264 | *dir_gone = 0; |
258 | 265 | ret = 1; |
259 | 266 | } |
@@ -297,6 +304,9 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag, |
297 | 304 | quote_path(path->buf, prefix, "ed, 0); |
298 | 305 | errno = saved_errno; |
299 | 306 | warning_errno(_(msg_warn_remove_failed), quoted.buf); |
| 307 | + if (saved_errno == ENAMETOOLONG) { |
| 308 | + advise_if_enabled(ADVICE_NAME_TOO_LONG, _("Setting `core.longPaths` may allow the deletion to succeed.")); |
| 309 | + } |
300 | 310 | *dir_gone = 0; |
301 | 311 | ret = 1; |
302 | 312 | } |
@@ -1116,6 +1126,9 @@ int cmd_clean(int argc, const char **argv, const char *prefix) |
1116 | 1126 | qname = quote_path(item->string, NULL, &buf, 0); |
1117 | 1127 | errno = saved_errno; |
1118 | 1128 | warning_errno(_(msg_warn_remove_failed), qname); |
| 1129 | + if (saved_errno == ENAMETOOLONG) { |
| 1130 | + advise_if_enabled(ADVICE_NAME_TOO_LONG, _("Setting `core.longPaths` may allow the deletion to succeed.")); |
| 1131 | + } |
1119 | 1132 | errors++; |
1120 | 1133 | } else if (!quiet) { |
1121 | 1134 | qname = quote_path(item->string, NULL, &buf, 0); |
|
0 commit comments