@@ -35,6 +35,7 @@ static int verbose;
3535static int mark_valid_only ;
3636static int mark_skip_worktree_only ;
3737static int mark_fsmonitor_only ;
38+ static int ignore_skip_worktree_entries ;
3839#define MARK_FLAG 1
3940#define UNMARK_FLAG 2
4041static struct strbuf mtime_dir = STRBUF_INIT ;
@@ -381,7 +382,8 @@ static int process_path(const char *path, struct stat *st, int stat_errno)
381382 * so updating it does not make sense.
382383 * On the other hand, removing it from index should work
383384 */
384- if (allow_remove && remove_file_from_cache (path ))
385+ if (!ignore_skip_worktree_entries && allow_remove &&
386+ remove_file_from_cache (path ))
385387 return error ("%s: cannot remove from the index" , path );
386388 return 0 ;
387389 }
@@ -1014,6 +1016,8 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
10141016 {OPTION_SET_INT , 0 , "no-skip-worktree" , & mark_skip_worktree_only , NULL ,
10151017 N_ ("clear skip-worktree bit" ),
10161018 PARSE_OPT_NOARG | PARSE_OPT_NONEG , NULL , UNMARK_FLAG },
1019+ OPT_BOOL (0 , "ignore-skip-worktree-entries" , & ignore_skip_worktree_entries ,
1020+ N_ ("do not touch index-only entries" )),
10171021 OPT_SET_INT (0 , "info-only" , & info_only ,
10181022 N_ ("add to index only; do not add content to object database" ), 1 ),
10191023 OPT_SET_INT (0 , "force-remove" , & force_remove ,
0 commit comments