Merge pull request #3817 from mathstuf/name-too-long-advice

clean: suggest using `core.longPaths` if paths are too long to remove
This commit is contained in:
Johannes Schindelin
2022-04-22 23:46:50 +02:00
4 changed files with 18 additions and 0 deletions

View File

@@ -118,6 +118,9 @@ advice.*::
waitingForEditor::
Print a message to the terminal whenever Git is waiting for
editor input from the user.
nameTooLong::
Advice shown if a filepath operation is attempted where the
path was too long.
nestedTag::
Advice shown if a user attempts to recursively tag a tag object.
submoduleAlternateErrorStrategyDie::

View File

@@ -51,6 +51,7 @@ static struct {
[ADVICE_GRAFT_FILE_DEPRECATED] = { "graftFileDeprecated", 1 },
[ADVICE_IGNORED_HOOK] = { "ignoredHook", 1 },
[ADVICE_IMPLICIT_IDENTITY] = { "implicitIdentity", 1 },
[ADVICE_NAME_TOO_LONG] = { "nameTooLong", 1 },
[ADVICE_NESTED_TAG] = { "nestedTag", 1 },
[ADVICE_OBJECT_NAME_WARNING] = { "objectNameWarning", 1 },
[ADVICE_PUSH_ALREADY_EXISTS] = { "pushAlreadyExists", 1 },

View File

@@ -25,6 +25,7 @@ struct string_list;
ADVICE_GRAFT_FILE_DEPRECATED,
ADVICE_IGNORED_HOOK,
ADVICE_IMPLICIT_IDENTITY,
ADVICE_NAME_TOO_LONG,
ADVICE_NESTED_TAG,
ADVICE_OBJECT_NAME_WARNING,
ADVICE_PUSH_ALREADY_EXISTS,

View File

@@ -24,6 +24,7 @@
#include "pathspec.h"
#include "help.h"
#include "prompt.h"
#include "advice.h"
static int force = -1; /* unset */
static int interactive;
@@ -219,6 +220,9 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
quote_path(path->buf, prefix, &quoted, 0);
errno = saved_errno;
warning_errno(_(msg_warn_remove_failed), quoted.buf);
if (saved_errno == ENAMETOOLONG) {
advise_if_enabled(ADVICE_NAME_TOO_LONG, _("Setting `core.longPaths` may allow the deletion to succeed."));
}
*dir_gone = 0;
}
ret = res;
@@ -254,6 +258,9 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
quote_path(path->buf, prefix, &quoted, 0);
errno = saved_errno;
warning_errno(_(msg_warn_remove_failed), quoted.buf);
if (saved_errno == ENAMETOOLONG) {
advise_if_enabled(ADVICE_NAME_TOO_LONG, _("Setting `core.longPaths` may allow the deletion to succeed."));
}
*dir_gone = 0;
ret = 1;
}
@@ -297,6 +304,9 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
quote_path(path->buf, prefix, &quoted, 0);
errno = saved_errno;
warning_errno(_(msg_warn_remove_failed), quoted.buf);
if (saved_errno == ENAMETOOLONG) {
advise_if_enabled(ADVICE_NAME_TOO_LONG, _("Setting `core.longPaths` may allow the deletion to succeed."));
}
*dir_gone = 0;
ret = 1;
}
@@ -1116,6 +1126,9 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
qname = quote_path(item->string, NULL, &buf, 0);
errno = saved_errno;
warning_errno(_(msg_warn_remove_failed), qname);
if (saved_errno == ENAMETOOLONG) {
advise_if_enabled(ADVICE_NAME_TOO_LONG, _("Setting `core.longPaths` may allow the deletion to succeed."));
}
errors++;
} else if (!quiet) {
qname = quote_path(item->string, NULL, &buf, 0);