mirror of
https://github.com/git-for-windows/git.git
synced 2026-02-04 03:33:01 -06:00
clean: suggest using core.longPaths if paths are too long to remove
On Windows, git repositories may have extra files which need cleaned (e.g., a build directory) that may be arbitrarily deep. Suggest using `core.longPaths` if such situations are encountered. Fixes: #2715 Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
This commit is contained in:
parent
5b3d5e5d9c
commit
f481f5fe01
@ -64,6 +64,9 @@ all advice messages.
|
||||
set their identity configuration.
|
||||
mergeConflict::
|
||||
Shown when various commands stop because of conflicts.
|
||||
nameTooLong::
|
||||
Advice shown if a filepath operation is attempted where the
|
||||
path was too long.
|
||||
nestedTag::
|
||||
Shown when a user attempts to recursively tag a tag object.
|
||||
pushAlreadyExists::
|
||||
|
||||
1
advice.c
1
advice.c
@ -61,6 +61,7 @@ static struct {
|
||||
[ADVICE_IGNORED_HOOK] = { "ignoredHook" },
|
||||
[ADVICE_IMPLICIT_IDENTITY] = { "implicitIdentity" },
|
||||
[ADVICE_MERGE_CONFLICT] = { "mergeConflict" },
|
||||
[ADVICE_NAME_TOO_LONG] = { "nameTooLong" },
|
||||
[ADVICE_NESTED_TAG] = { "nestedTag" },
|
||||
[ADVICE_OBJECT_NAME_WARNING] = { "objectNameWarning" },
|
||||
[ADVICE_PUSH_ALREADY_EXISTS] = { "pushAlreadyExists" },
|
||||
|
||||
1
advice.h
1
advice.h
@ -28,6 +28,7 @@ enum advice_type {
|
||||
ADVICE_IGNORED_HOOK,
|
||||
ADVICE_IMPLICIT_IDENTITY,
|
||||
ADVICE_MERGE_CONFLICT,
|
||||
ADVICE_NAME_TOO_LONG,
|
||||
ADVICE_NESTED_TAG,
|
||||
ADVICE_OBJECT_NAME_WARNING,
|
||||
ADVICE_PUSH_ALREADY_EXISTS,
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
#include "pathspec.h"
|
||||
#include "help.h"
|
||||
#include "prompt.h"
|
||||
#include "advice.h"
|
||||
|
||||
static int require_force = -1; /* unset */
|
||||
static int interactive;
|
||||
@ -221,6 +222,9 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
|
||||
quote_path(path->buf, prefix, "ed, 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;
|
||||
@ -256,6 +260,9 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
|
||||
quote_path(path->buf, prefix, "ed, 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;
|
||||
}
|
||||
@ -299,6 +306,9 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
|
||||
quote_path(path->buf, prefix, "ed, 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;
|
||||
}
|
||||
@ -1109,6 +1119,9 @@ int cmd_clean(int argc,
|
||||
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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user