|
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 require_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 | }
|
@@ -1106,6 +1116,9 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
|
1106 | 1116 | qname = quote_path(item->string, NULL, &buf, 0);
|
1107 | 1117 | errno = saved_errno;
|
1108 | 1118 | warning_errno(_(msg_warn_remove_failed), qname);
|
| 1119 | + if (saved_errno == ENAMETOOLONG) { |
| 1120 | + advise_if_enabled(ADVICE_NAME_TOO_LONG, _("Setting `core.longPaths` may allow the deletion to succeed.")); |
| 1121 | + } |
1109 | 1122 | errors++;
|
1110 | 1123 | } else if (!quiet) {
|
1111 | 1124 | qname = quote_path(item->string, NULL, &buf, 0);
|
|
0 commit comments