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