@@ -35,6 +35,7 @@ static int verbose;
35
35
static int mark_valid_only ;
36
36
static int mark_skip_worktree_only ;
37
37
static int mark_fsmonitor_only ;
38
+ static int ignore_skip_worktree_entries ;
38
39
#define MARK_FLAG 1
39
40
#define UNMARK_FLAG 2
40
41
static struct strbuf mtime_dir = STRBUF_INIT ;
@@ -381,7 +382,8 @@ static int process_path(const char *path, struct stat *st, int stat_errno)
381
382
* so updating it does not make sense.
382
383
* On the other hand, removing it from index should work
383
384
*/
384
- if (allow_remove && remove_file_from_cache (path ))
385
+ if (!ignore_skip_worktree_entries && allow_remove &&
386
+ remove_file_from_cache (path ))
385
387
return error ("%s: cannot remove from the index" , path );
386
388
return 0 ;
387
389
}
@@ -1014,6 +1016,8 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
1014
1016
{OPTION_SET_INT , 0 , "no-skip-worktree" , & mark_skip_worktree_only , NULL ,
1015
1017
N_ ("clear skip-worktree bit" ),
1016
1018
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" )),
1017
1021
OPT_SET_INT (0 , "info-only" , & info_only ,
1018
1022
N_ ("add to index only; do not add content to object database" ), 1 ),
1019
1023
OPT_SET_INT (0 , "force-remove" , & force_remove ,
0 commit comments