|
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 force = -1; /* unset */
|
28 | 29 | static int interactive;
|
@@ -215,6 +216,9 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
|
215 | 216 | quote_path(path->buf, prefix, "ed, 0);
|
216 | 217 | errno = saved_errno;
|
217 | 218 | warning_errno(_(msg_warn_remove_failed), quoted.buf);
|
| 219 | + if (saved_errno == ENAMETOOLONG) { |
| 220 | + advise_if_enabled(ADVICE_NAME_TOO_LONG, _("Setting `core.longPaths` may allow the deletion to succeed.")); |
| 221 | + } |
218 | 222 | *dir_gone = 0;
|
219 | 223 | }
|
220 | 224 | ret = res;
|
@@ -250,6 +254,9 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
|
250 | 254 | quote_path(path->buf, prefix, "ed, 0);
|
251 | 255 | errno = saved_errno;
|
252 | 256 | warning_errno(_(msg_warn_remove_failed), quoted.buf);
|
| 257 | + if (saved_errno == ENAMETOOLONG) { |
| 258 | + advise_if_enabled(ADVICE_NAME_TOO_LONG, _("Setting `core.longPaths` may allow the deletion to succeed.")); |
| 259 | + } |
253 | 260 | *dir_gone = 0;
|
254 | 261 | ret = 1;
|
255 | 262 | }
|
@@ -293,6 +300,9 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
|
293 | 300 | quote_path(path->buf, prefix, "ed, 0);
|
294 | 301 | errno = saved_errno;
|
295 | 302 | warning_errno(_(msg_warn_remove_failed), quoted.buf);
|
| 303 | + if (saved_errno == ENAMETOOLONG) { |
| 304 | + advise_if_enabled(ADVICE_NAME_TOO_LONG, _("Setting `core.longPaths` may allow the deletion to succeed.")); |
| 305 | + } |
296 | 306 | *dir_gone = 0;
|
297 | 307 | ret = 1;
|
298 | 308 | }
|
@@ -1112,6 +1122,9 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
|
1112 | 1122 | qname = quote_path(item->string, NULL, &buf, 0);
|
1113 | 1123 | errno = saved_errno;
|
1114 | 1124 | warning_errno(_(msg_warn_remove_failed), qname);
|
| 1125 | + if (saved_errno == ENAMETOOLONG) { |
| 1126 | + advise_if_enabled(ADVICE_NAME_TOO_LONG, _("Setting `core.longPaths` may allow the deletion to succeed.")); |
| 1127 | + } |
1115 | 1128 | errors++;
|
1116 | 1129 | } else if (!quiet) {
|
1117 | 1130 | qname = quote_path(item->string, NULL, &buf, 0);
|
|
0 commit comments