Teach Git to respect skip-worktree bit (reading part)
grep: turn on --cached for files that is marked skip-worktree ls-files: do not check for deleted file that is marked skip-worktree update-index: ignore update request if it's skip-worktree, while still allows removing diff*: skip worktree version Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
44a3691362
commit
b4d1690df1
@ -180,6 +180,11 @@ static void add_remove_files(struct string_list *list)
|
||||
for (i = 0; i < list->nr; i++) {
|
||||
struct stat st;
|
||||
struct string_list_item *p = &(list->items[i]);
|
||||
int pos = index_name_pos(&the_index, p->string, strlen(p->string));
|
||||
struct cache_entry *ce = pos < 0 ? NULL : active_cache[pos];
|
||||
|
||||
if (ce && ce_skip_worktree(ce))
|
||||
continue;
|
||||
|
||||
if (!lstat(p->string, &st)) {
|
||||
if (add_to_cache(p->string, &st, 0))
|
||||
|
Reference in New Issue
Block a user