From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 0212C1F8C8 for ; Fri, 8 Oct 2021 09:04:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235162AbhJHJGQ (ORCPT ); Fri, 8 Oct 2021 05:06:16 -0400 Received: from pb-smtp2.pobox.com ([64.147.108.71]:54246 "EHLO pb-smtp2.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233828AbhJHJGO (ORCPT ); Fri, 8 Oct 2021 05:06:14 -0400 Received: from pb-smtp2.pobox.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id 65EE9F6CEC; Fri, 8 Oct 2021 05:04:19 -0400 (EDT) (envelope-from junio@pobox.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:message-id:mime-version:content-type; s=sasl; bh=HVoLtpQ0bJe6Tk7Z9zaqmKnuQ1pFuZkIj4zzsuQjy/k=; b=SOGf RRIKjskYkw0b64VxX+nc/WmUDFkhkh25aVUelkBS+uBXS+A+st+wICIr1GfcuzZh wkGGUVhfKQ3SOkkWp3MaO4GEIAwoDi1jr/OGyYTxT5cFFFA5i/r1OWkiQtiMHbbb Hsbe49rCXauhT8FNG1h+1/o1yLLgULhTGK9cmfM= Received: from pb-smtp2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id 5CE2AF6CEB; Fri, 8 Oct 2021 05:04:19 -0400 (EDT) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [104.133.2.91]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp2.pobox.com (Postfix) with ESMTPSA id C6986F6CEA; Fri, 8 Oct 2021 05:04:18 -0400 (EDT) (envelope-from junio@pobox.com) From: Junio C Hamano To: "Kevin Willford via GitGitGadget" Cc: git@vger.kernel.org, stolee@gmail.com, newren@gmail.com, Taylor Blau , Bagas Sanjaya , =?utf-8?B?w4Z2?= =?utf-8?B?YXIgQXJuZmrDtnLDsA==?= Bjarmason , Victoria Dye , Kevin Willford Subject: Re: [PATCH v3 2/8] reset: preserve skip-worktree bit in mixed reset References: <1f6da84830b00b7d33ac8ae4c6a46a90606c901f.1633641339.git.gitgitgadget@gmail.com> Date: Fri, 08 Oct 2021 02:04:17 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: B851183E-2816-11EC-B1F6-CD991BBA3BAF-77302942!pb-smtp2.pobox.com Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org "Kevin Willford via GitGitGadget" writes: > @@ -141,6 +143,18 @@ static void update_index_from_diff(struct diff_queue_struct *q, > > ce = make_cache_entry(&the_index, one->mode, &one->oid, one->path, > 0, 0); > + > + /* > + * If the file 1) corresponds to an existing index entry with > + * skip-worktree set, or 2) does not exist in the index but is > + * outside the sparse checkout definition, add a skip-worktree bit > + * to the new index entry. > + */ > + pos = cache_name_pos(one->path, strlen(one->path)); > + if ((pos >= 0 && ce_skip_worktree(active_cache[pos])) || > + (pos < 0 && !path_in_sparse_checkout(one->path, &the_index))) > + ce->ce_flags |= CE_SKIP_WORKTREE; OK. Nicely explained.