From a20f70478ffcc66d30936920ebcc35ebfc12a7c7 Mon Sep 17 00:00:00 2001 From: Matheus Tavares Date: Thu, 8 Apr 2021 17:41:27 -0300 Subject: 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 Signed-off-by: Junio C Hamano --- advice.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'advice.h') diff --git a/advice.h b/advice.h index bc2432980a..bd26c385d0 100644 --- a/advice.h +++ b/advice.h @@ -3,6 +3,8 @@ #include "git-compat-util.h" +struct string_list; + extern int advice_fetch_show_forced_updates; extern int advice_push_update_rejected; extern int advice_push_non_ff_current; @@ -71,6 +73,7 @@ extern int advice_add_empty_pathspec; ADVICE_STATUS_HINTS, ADVICE_STATUS_U_OPTION, ADVICE_SUBMODULE_ALTERNATE_ERROR_STRATEGY_DIE, + ADVICE_UPDATE_SPARSE_PATH, ADVICE_WAITING_FOR_EDITOR, }; @@ -92,6 +95,7 @@ void advise_if_enabled(enum advice_type type, const char *advice, ...); int error_resolve_conflict(const char *me); void NORETURN die_resolve_conflict(const char *me); void NORETURN die_conclude_merge(void); +void advise_on_updating_sparse_paths(struct string_list *pathspec_list); void detach_advice(const char *new_name); #endif /* ADVICE_H */ -- cgit v1.2.3