mirror of
https://github.com/git/git.git
synced 2024-05-23 17:16:18 +02:00
advice: update message to suggest '--sparse'
The previous changes modified the behavior of 'git add', 'git rm', and 'git mv' to not adjust paths outside the sparse-checkout cone, even if they exist in the working tree and their cache entries lack the SKIP_WORKTREE bit. The intention is to warn users that they are doing something potentially dangerous. The '--sparse' option was added to each command to allow careful users the same ability they had before. To improve the discoverability of this new functionality, add a message to advice.updateSparsePath that mentions the existence of the option. The previous set of changes also modified the purpose of this message to include possibly a list of paths instead of only a list of pathspecs. Make the warning message more clear about this new behavior. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
93d2c16041
commit
6579e788c0
11
advice.c
11
advice.c
|
@ -293,15 +293,16 @@ void advise_on_updating_sparse_paths(struct string_list *pathspec_list)
|
||||||
if (!pathspec_list->nr)
|
if (!pathspec_list->nr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fprintf(stderr, _("The following pathspecs didn't match any"
|
fprintf(stderr, _("The following paths and/or pathspecs matched paths that exist\n"
|
||||||
" eligible path, but they do match index\n"
|
"outside of your sparse-checkout definition, so will not be\n"
|
||||||
"entries outside the current sparse checkout:\n"));
|
"updated in the index:\n"));
|
||||||
for_each_string_list_item(item, pathspec_list)
|
for_each_string_list_item(item, pathspec_list)
|
||||||
fprintf(stderr, "%s\n", item->string);
|
fprintf(stderr, "%s\n", item->string);
|
||||||
|
|
||||||
advise_if_enabled(ADVICE_UPDATE_SPARSE_PATH,
|
advise_if_enabled(ADVICE_UPDATE_SPARSE_PATH,
|
||||||
_("Disable or modify the sparsity rules if you intend"
|
_("If you intend to update such entries, try one of the following:\n"
|
||||||
" to update such entries."));
|
"* Use the --sparse option.\n"
|
||||||
|
"* Disable or modify the sparsity rules."));
|
||||||
}
|
}
|
||||||
|
|
||||||
void detach_advice(const char *new_name)
|
void detach_advice(const char *new_name)
|
||||||
|
|
|
@ -11,12 +11,15 @@ test_expect_success 'setup' "
|
||||||
git commit -m files &&
|
git commit -m files &&
|
||||||
|
|
||||||
cat >sparse_error_header <<-EOF &&
|
cat >sparse_error_header <<-EOF &&
|
||||||
The following pathspecs didn't match any eligible path, but they do match index
|
The following paths and/or pathspecs matched paths that exist
|
||||||
entries outside the current sparse checkout:
|
outside of your sparse-checkout definition, so will not be
|
||||||
|
updated in the index:
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
cat >sparse_hint <<-EOF &&
|
cat >sparse_hint <<-EOF &&
|
||||||
hint: Disable or modify the sparsity rules if you intend to update such entries.
|
hint: If you intend to update such entries, try one of the following:
|
||||||
|
hint: * Use the --sparse option.
|
||||||
|
hint: * Disable or modify the sparsity rules.
|
||||||
hint: Disable this message with \"git config advice.updateSparsePath false\"
|
hint: Disable this message with \"git config advice.updateSparsePath false\"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
|
@ -44,12 +44,15 @@ test_sparse_entry_unstaged () {
|
||||||
|
|
||||||
test_expect_success 'setup' "
|
test_expect_success 'setup' "
|
||||||
cat >sparse_error_header <<-EOF &&
|
cat >sparse_error_header <<-EOF &&
|
||||||
The following pathspecs didn't match any eligible path, but they do match index
|
The following paths and/or pathspecs matched paths that exist
|
||||||
entries outside the current sparse checkout:
|
outside of your sparse-checkout definition, so will not be
|
||||||
|
updated in the index:
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
cat >sparse_hint <<-EOF &&
|
cat >sparse_hint <<-EOF &&
|
||||||
hint: Disable or modify the sparsity rules if you intend to update such entries.
|
hint: If you intend to update such entries, try one of the following:
|
||||||
|
hint: * Use the --sparse option.
|
||||||
|
hint: * Disable or modify the sparsity rules.
|
||||||
hint: Disable this message with \"git config advice.updateSparsePath false\"
|
hint: Disable this message with \"git config advice.updateSparsePath false\"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
|
@ -11,12 +11,15 @@ test_expect_success 'setup' "
|
||||||
git commit -m files &&
|
git commit -m files &&
|
||||||
|
|
||||||
cat >sparse_error_header <<-EOF &&
|
cat >sparse_error_header <<-EOF &&
|
||||||
The following pathspecs didn't match any eligible path, but they do match index
|
The following paths and/or pathspecs matched paths that exist
|
||||||
entries outside the current sparse checkout:
|
outside of your sparse-checkout definition, so will not be
|
||||||
|
updated in the index:
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
cat >sparse_hint <<-EOF
|
cat >sparse_hint <<-EOF
|
||||||
hint: Disable or modify the sparsity rules if you intend to update such entries.
|
hint: If you intend to update such entries, try one of the following:
|
||||||
|
hint: * Use the --sparse option.
|
||||||
|
hint: * Disable or modify the sparsity rules.
|
||||||
hint: Disable this message with \"git config advice.updateSparsePath false\"
|
hint: Disable this message with \"git config advice.updateSparsePath false\"
|
||||||
EOF
|
EOF
|
||||||
"
|
"
|
||||||
|
|
Loading…
Reference in New Issue