add: warn when asked to update SKIP_WORKTREE entries
authorMatheus Tavares <matheus.bernardino@usp.br>
Thu, 8 Apr 2021 20:41:27 +0000 (17:41 -0300)
committerJunio C Hamano <gitster@pobox.com>
Thu, 8 Apr 2021 21:18:03 +0000 (14:18 -0700)
commita20f70478ffcc66d30936920ebcc35ebfc12a7c7
tree1e5865434bde7d8f5a94bb6f93ba304df307bd4c
parentb243012cb39e2151ffae96bded2387751d876d12
add: warn when asked to update SKIP_WORKTREE entries

`git add` already refrains from updating SKIP_WORKTREE entries, but it
silently exits with zero code when it is asked to do so. Instead, let's
warn the user and display a hint on how to update these entries.

Note that we only warn the user whey they give a pathspec item that
matches no eligible path for updating, but it does match one or more
SKIP_WORKTREE entries. A warning was chosen over erroring out right away
to reproduce the same behavior `add` already exhibits with ignored
files. This also allow users to continue their workflow without having
to invoke `add` again with only the eligible paths (as those will have
already been added).

Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/config/advice.txt
advice.c
advice.h
builtin/add.c
pathspec.c
pathspec.h
t/t3705-add-sparse-checkout.sh