Skip to content

Commit

Permalink
advice: update message to suggest '--sparse'
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
  • Loading branch information
derrickstolee committed Aug 30, 2021
1 parent c5be4b3 commit 72d57ad
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion advice.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,8 @@ void advise_on_updating_sparse_paths(struct string_list *pathspec_list)
fprintf(stderr, "%s\n", item->string);

advise_if_enabled(ADVICE_UPDATE_SPARSE_PATH,
_("Disable or modify the sparsity rules if you intend"
_("Disable or modify the sparsity rules or"
" use the --sparse option if you intend"
" to update such entries."));
}

Expand Down
2 changes: 1 addition & 1 deletion t/t3602-rm-sparse-checkout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ test_expect_success 'setup' "
EOF
cat >sparse_hint <<-EOF &&
hint: Disable or modify the sparsity rules if you intend to update such entries.
hint: Disable or modify the sparsity rules or use the --sparse option if you intend to update such entries.
hint: Disable this message with \"git config advice.updateSparsePath false\"
EOF
Expand Down
2 changes: 1 addition & 1 deletion t/t3705-add-sparse-checkout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ test_expect_success 'setup' "
EOF
cat >sparse_hint <<-EOF &&
hint: Disable or modify the sparsity rules if you intend to update such entries.
hint: Disable or modify the sparsity rules or use the --sparse option if you intend to update such entries.
hint: Disable this message with \"git config advice.updateSparsePath false\"
EOF
Expand Down
2 changes: 1 addition & 1 deletion t/t7002-mv-sparse-checkout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ test_expect_success 'setup' "
EOF
cat >sparse_hint <<-EOF
hint: Disable or modify the sparsity rules if you intend to update such entries.
hint: Disable or modify the sparsity rules or use the --sparse option if you intend to update such entries.
hint: Disable this message with \"git config advice.updateSparsePath false\"
EOF
"
Expand Down

0 comments on commit 72d57ad

Please sign in to comment.