From patchwork Tue Mar 17 18:57:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matheus Tavares X-Patchwork-Id: 11443789 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9885D1667 for ; Tue, 17 Mar 2020 18:58:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 758A020724 for ; Tue, 17 Mar 2020 18:58:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=usp-br.20150623.gappssmtp.com header.i=@usp-br.20150623.gappssmtp.com header.b="HcKeh8Ai" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726555AbgCQS6b (ORCPT ); Tue, 17 Mar 2020 14:58:31 -0400 Received: from mail-qk1-f194.google.com ([209.85.222.194]:36460 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726294AbgCQS6b (ORCPT ); Tue, 17 Mar 2020 14:58:31 -0400 Received: by mail-qk1-f194.google.com with SMTP id u25so34461283qkk.3 for ; Tue, 17 Mar 2020 11:58:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=usp-br.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=U9JuKsd1AwbGjjEfLiRCBaOE3lF8n5U9gEctarqdXpY=; b=HcKeh8AiPN1ZaEfWhYvdHPa1yXMyhhJQ/p1M3BBmu15spcqJV8kbio4JUPV+uxzA8A V0lHILyREIBOqxsTewD2gm+JZU4Oqgj9n787rQJYrYZpGgOiQzDr+zt40Bybt3WkxSog 07ZWSU8na5cSjKnPXggVKEJvCM6E/dwhn/UTYNMpmnxO63q3/HuvhPNGopSt0Uj3KZcE bGkXBr0t2J9kbGpu05gIPVGx+LY8K1k0J0pycXZfmy+gR/YlBrQ80pk7Wy+nkKm0LGqZ wcUC16Z+XH3+MANYt3W/m1mfiEvCzZ+dV9y2XtWrKS0DZ0pP/SL4ZyBWgpM2GPWFXlHK FLzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=U9JuKsd1AwbGjjEfLiRCBaOE3lF8n5U9gEctarqdXpY=; b=KiRuYLlku2eXDyMlzkFQVc+ZoCZhNAnFNrDwkurUBLRKIB8O8dzXgzjjrI3FxllzY8 NvFDa/nVUv1ZPd7rU+BoryTrMXDKOJ9YLkhekrIJv1ig4c7MNOcM5HpA6FvX/pDzKGmg C+MmA4qVVihjLa/oFBp8Q4MQHzioA/nnU1GoUQwwVoV+uh4iwMCMDhaJ+XFrTzow5FWV 2E42nC6opRvm/A3xtBYapdohj39c1s6ImvcGoiRKaNNpY69NYsLjhXSeasQTWy1n7Yvw UZ4R1Es1fny3AL9/AeK57vRdBCZNQOuabzP7Z7u0j79NYw7WkgfsasZ1ISh0RSO0NYSt jeXQ== X-Gm-Message-State: ANhLgQ1HhOjsFekOCzGYI1FlRjOXeYlxi/zRxz09BdTDzci6UEOWD5iR SD4gKxyf9PJAuSoRBxwiQLmuQvGMHjY= X-Google-Smtp-Source: ADFU+vsDmutKe5QXurYg0jxaODJ8ojaPV88O3zj3J/R/O8wkKLhwKsTandoWUaFrYEcUNXkve5M8zw== X-Received: by 2002:ae9:e51a:: with SMTP id w26mr330809qkf.312.1584471509921; Tue, 17 Mar 2020 11:58:29 -0700 (PDT) Received: from mango.spo.virtua.com.br ([2804:14c:81:942d::2]) by smtp.gmail.com with ESMTPSA id n190sm2414707qkb.93.2020.03.17.11.58.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Mar 2020 11:58:29 -0700 (PDT) From: Matheus Tavares To: git@vger.kernel.org Cc: gitster@pobox.com, dreamer.tan@gmail.com, peff@peff.net Subject: [PATCH v2 1/3] dir: fix outdated comment on add_patterns() Date: Tue, 17 Mar 2020 15:57:43 -0300 Message-Id: <9de4c8cdee441be7d9bbef2a961a8ed7d423f448.1584471137.git.matheus.bernardino@usp.br> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In 4b33e60 ("dir: convert struct sha1_stat to use object_id", 2018-01-28), the struct sha1_stat was converted to oid_stat. In this process, add_patterns() also learned to use the new struct definition. However, the comments in this function still refers to "ss" (i.e. the old sha1_stat). Update that. Signed-off-by: Matheus Tavares --- dir.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dir.c b/dir.c index 0ffb1b3302..ab2e5b8717 100644 --- a/dir.c +++ b/dir.c @@ -1015,9 +1015,10 @@ static int add_patterns_from_buffer(char *buf, size_t size, * an index if 'istate' is non-null), parse it and store the * exclude rules in "pl". * - * If "ss" is not NULL, compute SHA-1 of the exclude file and fill + * If oid_stat is not NULL, compute OID of the exclude file and fill * stat data from disk (only valid if add_patterns returns zero). If - * ss_valid is non-zero, "ss" must contain good value as input. + * oid_stat->valid is non-zero, oid_stat must contain good value as + * input. */ static int add_patterns(const char *fname, const char *base, int baselen, struct pattern_list *pl, struct index_state *istate, @@ -1065,7 +1066,7 @@ static int add_patterns(const char *fname, const char *base, int baselen, int pos; if (oid_stat->valid && !match_stat_data_racy(istate, &oid_stat->stat, &st)) - ; /* no content change, ss->sha1 still good */ + ; /* no content change, oid_stat->oid still good */ else if (istate && (pos = index_name_pos(istate, fname, strlen(fname))) >= 0 && !ce_stage(istate->cache[pos]) && From patchwork Tue Mar 17 18:57:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matheus Tavares X-Patchwork-Id: 11443793 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 93D671667 for ; Tue, 17 Mar 2020 18:58:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 69B4120735 for ; Tue, 17 Mar 2020 18:58:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=usp-br.20150623.gappssmtp.com header.i=@usp-br.20150623.gappssmtp.com header.b="l7Z38Ja2" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726704AbgCQS6t (ORCPT ); Tue, 17 Mar 2020 14:58:49 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:46046 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726545AbgCQS6t (ORCPT ); Tue, 17 Mar 2020 14:58:49 -0400 Received: by mail-qt1-f196.google.com with SMTP id z8so15070604qto.12 for ; Tue, 17 Mar 2020 11:58:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=usp-br.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CVln3rObxm2GGO6t0ecAavg03ccKkcaXjzvHzlGKs+Q=; b=l7Z38Ja2NalyB6nH6gzLqDt8vC11U4QADI7lZG6LtwJkxmgEN/DEiQuk1I9HG1COPs kFpwxIRfYWYaSeQfZ+Nv/oIRYZe/V777ynEuPPhjj9FVC/e7WaMBRbdpj04P2MSWllLw sID3tuAnRaZJPI5gEO4pkUrxYuGIipbTS9k8jOFKEqwUMZNc4dYHIr/ZTPy1UrluZhJR LWSOE+nkvvc7xnzkl0ZQHIE9UKf8aegixvTx76QdC34Vq6bTwEoniTZzNdrcVsuxbbb2 cKYeEbIPIk+OZGs6u+7JfkVo0bXBCJgsXgAtlQxC7FsnW/FT/vQLsM5AeGAenmEF9J3h MqVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CVln3rObxm2GGO6t0ecAavg03ccKkcaXjzvHzlGKs+Q=; b=pMcyxtT8j3b4QxH7wk4WGVM3tBFqPEoOf+w3dI1vvIKj+RVgqCQ0hPYyDd2xQnI3RZ ayx63lgok9d/CNX5G3JMr7qJVXqP203ASmFB5VGW8k0ykuhOBPLDGP93ZzJTZfkZYTFw cskiXhE62dbGcFo4uclkY6Qd8AZSxIt9ytIwkgdbMj4hZHA1v7luLf67ZbSh8c4OaNMw 4gapNlm/5NxhpaEcVSSqXZH43N+nvwcBDsY+2qMBgiDZsCR1Yqhu0EopPdOUi4C+eTGj kNSZaoTgDdc3Ww4muRrQPug2Mi08EgWAnueLMuxsbrFak97AYDecoY97L1Shf2Q0xU5X v5jA== X-Gm-Message-State: ANhLgQ2tMkKBN8rC/WZx7R4Q+J5sFeparJfuHU0pRJkIFA7ZcZbIymZV FuRUFqNIHfDQjLhryKtR6yaOes0C/Hc= X-Google-Smtp-Source: ADFU+vvA3z535nZnGtuKOTlUYGr02Ojk/0kKyd1dLjLbtOAVdjPXrj/3zkp5r1I9c707s7E5r8mPtw== X-Received: by 2002:ac8:60ce:: with SMTP id i14mr607742qtm.87.1584471527261; Tue, 17 Mar 2020 11:58:47 -0700 (PDT) Received: from mango.spo.virtua.com.br ([2804:14c:81:942d::2]) by smtp.gmail.com with ESMTPSA id n190sm2414707qkb.93.2020.03.17.11.58.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Mar 2020 11:58:46 -0700 (PDT) From: Matheus Tavares To: git@vger.kernel.org Cc: gitster@pobox.com, dreamer.tan@gmail.com, peff@peff.net Subject: [PATCH v2 2/3] dir: improve naming of oid_stat fields in two structs Date: Tue, 17 Mar 2020 15:57:44 -0300 Message-Id: <776db73a8c2bd95f787d6398c41bc69c063be858.1584471137.git.matheus.bernardino@usp.br> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Both "struct untracked_cache" and "struct dir_struct" contain fields of the type "struct oid_stat". The latter used to be called "sha1_stat" before 4b33e60 ("dir: convert struct sha1_stat to use object_id", 2018-01-28). Although this struct was renamed, the previously mentioned fields are still named with an "ss_" prefix ("ss_info_exclude" and "ss_excludes_file"), which refers to the old "sha1_stat". As this can be confusing, let's rename these fields. Since "struct oid_stat" is used to query the validity of cached data, a better naming alternative would be "info_exclude_validity" and "excludes_file_validity". Helped-by: Junio C Hamano Signed-off-by: Matheus Tavares --- dir.c | 34 ++++++++++++++++------------ dir.h | 8 +++---- t/helper/test-dump-untracked-cache.c | 5 ++-- 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/dir.c b/dir.c index ab2e5b8717..92226b1af2 100644 --- a/dir.c +++ b/dir.c @@ -2613,15 +2613,17 @@ static struct untracked_cache_dir *validate_untracked_cache(struct dir_struct *d /* Validate $GIT_DIR/info/exclude and core.excludesfile */ root = dir->untracked->root; - if (!oideq(&dir->ss_info_exclude.oid, - &dir->untracked->ss_info_exclude.oid)) { + if (!oideq(&dir->info_exclude_validity.oid, + &dir->untracked->info_exclude_validity.oid)) { invalidate_gitignore(dir->untracked, root); - dir->untracked->ss_info_exclude = dir->ss_info_exclude; + dir->untracked->info_exclude_validity = + dir->info_exclude_validity; } - if (!oideq(&dir->ss_excludes_file.oid, - &dir->untracked->ss_excludes_file.oid)) { + if (!oideq(&dir->excludes_file_validity.oid, + &dir->untracked->excludes_file_validity.oid)) { invalidate_gitignore(dir->untracked, root); - dir->untracked->ss_excludes_file = dir->ss_excludes_file; + dir->untracked->excludes_file_validity = + dir->excludes_file_validity; } /* Make sure this directory is not dropped out at saving phase */ @@ -2884,14 +2886,16 @@ void setup_standard_excludes(struct dir_struct *dir) excludes_file = xdg_config_home("ignore"); if (excludes_file && !access_or_warn(excludes_file, R_OK, 0)) add_patterns_from_file_1(dir, excludes_file, - dir->untracked ? &dir->ss_excludes_file : NULL); + dir->untracked ? + &dir->excludes_file_validity : NULL); /* per repository user preference */ if (startup_info->have_repository) { const char *path = git_path_info_exclude(); if (!access_or_warn(path, R_OK, 0)) add_patterns_from_file_1(dir, path, - dir->untracked ? &dir->ss_info_exclude : NULL); + dir->untracked ? + &dir->info_exclude_validity : NULL); } } @@ -3037,8 +3041,10 @@ void write_untracked_extension(struct strbuf *out, struct untracked_cache *untra const unsigned hashsz = the_hash_algo->rawsz; ouc = xcalloc(1, sizeof(*ouc)); - stat_data_to_disk(&ouc->info_exclude_stat, &untracked->ss_info_exclude.stat); - stat_data_to_disk(&ouc->excludes_file_stat, &untracked->ss_excludes_file.stat); + stat_data_to_disk(&ouc->info_exclude_stat, + &untracked->info_exclude_validity.stat); + stat_data_to_disk(&ouc->excludes_file_stat, + &untracked->excludes_file_validity.stat); ouc->dir_flags = htonl(untracked->dir_flags); varint_len = encode_varint(untracked->ident.len, varbuf); @@ -3046,8 +3052,8 @@ void write_untracked_extension(struct strbuf *out, struct untracked_cache *untra strbuf_addbuf(out, &untracked->ident); strbuf_add(out, ouc, sizeof(*ouc)); - strbuf_add(out, untracked->ss_info_exclude.oid.hash, hashsz); - strbuf_add(out, untracked->ss_excludes_file.oid.hash, hashsz); + strbuf_add(out, untracked->info_exclude_validity.oid.hash, hashsz); + strbuf_add(out, untracked->excludes_file_validity.oid.hash, hashsz); strbuf_add(out, untracked->exclude_per_dir, strlen(untracked->exclude_per_dir) + 1); FREE_AND_NULL(ouc); @@ -3250,10 +3256,10 @@ struct untracked_cache *read_untracked_extension(const void *data, unsigned long uc = xcalloc(1, sizeof(*uc)); strbuf_init(&uc->ident, ident_len); strbuf_add(&uc->ident, ident, ident_len); - load_oid_stat(&uc->ss_info_exclude, + load_oid_stat(&uc->info_exclude_validity, next + ouc_offset(info_exclude_stat), next + offset); - load_oid_stat(&uc->ss_excludes_file, + load_oid_stat(&uc->excludes_file_validity, next + ouc_offset(excludes_file_stat), next + offset + hashsz); uc->dir_flags = get_be32(next + ouc_offset(dir_flags)); diff --git a/dir.h b/dir.h index 5855c065a6..6c3aaeba71 100644 --- a/dir.h +++ b/dir.h @@ -186,8 +186,8 @@ struct untracked_cache_dir { }; struct untracked_cache { - struct oid_stat ss_info_exclude; - struct oid_stat ss_excludes_file; + struct oid_stat info_exclude_validity; + struct oid_stat excludes_file_validity; const char *exclude_per_dir; struct strbuf ident; /* @@ -334,8 +334,8 @@ struct dir_struct { /* Enable untracked file cache if set */ struct untracked_cache *untracked; - struct oid_stat ss_info_exclude; - struct oid_stat ss_excludes_file; + struct oid_stat info_exclude_validity; + struct oid_stat excludes_file_validity; unsigned unmanaged_exclude_files; }; diff --git a/t/helper/test-dump-untracked-cache.c b/t/helper/test-dump-untracked-cache.c index cf0f2c7228..568a4588bb 100644 --- a/t/helper/test-dump-untracked-cache.c +++ b/t/helper/test-dump-untracked-cache.c @@ -56,8 +56,9 @@ int cmd__dump_untracked_cache(int ac, const char **av) printf("no untracked cache\n"); return 0; } - printf("info/exclude %s\n", oid_to_hex(&uc->ss_info_exclude.oid)); - printf("core.excludesfile %s\n", oid_to_hex(&uc->ss_excludes_file.oid)); + printf("info/exclude %s\n", oid_to_hex(&uc->info_exclude_validity.oid)); + printf("core.excludesfile %s\n", + oid_to_hex(&uc->excludes_file_validity.oid)); printf("exclude_per_dir %s\n", uc->exclude_per_dir); printf("flags %08x\n", uc->dir_flags); if (uc->root) From patchwork Tue Mar 17 18:57:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matheus Tavares X-Patchwork-Id: 11443795 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C20A092A for ; Tue, 17 Mar 2020 18:58:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9F7822073E for ; Tue, 17 Mar 2020 18:58:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=usp-br.20150623.gappssmtp.com header.i=@usp-br.20150623.gappssmtp.com header.b="wl9t6qh3" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726730AbgCQS6w (ORCPT ); Tue, 17 Mar 2020 14:58:52 -0400 Received: from mail-qk1-f194.google.com ([209.85.222.194]:42459 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726545AbgCQS6w (ORCPT ); Tue, 17 Mar 2020 14:58:52 -0400 Received: by mail-qk1-f194.google.com with SMTP id e11so34370338qkg.9 for ; Tue, 17 Mar 2020 11:58:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=usp-br.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=N+4Ieo4B8oWWhC7v2B/TeeRwInW87K1DN8UK7mhz8Fk=; b=wl9t6qh3PUrpcPKzpP7H283UYeseJ48q4XIvSAlHs74nJ3j7GDA76HWDmxf9rwQEYc uZ8b6HTPcD/S3sWefUXQ4QAowQjJDAKoS/EuZOHPINJatpV95tJzG/4mRNu3cSHccb2c a4ZYHOXEasC9qVsMOnm4+iOINghpBUlSJ/eLHWJ3d/RVd5nyVlHmV/5WJbNymom3e6LV RmTnKGpPkUlAz+CBkCBz+KTCHk2cRgLwajHtVvqc4dQuXotwBLxsbLrhEqPLdFuHsdAS R1bNuMXCpuHQmxD+V8lGpZMm24r+25yLeH6K7B7A2ft+gFAoimNyt/+Xz4GzKVf+yUGW 59eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=N+4Ieo4B8oWWhC7v2B/TeeRwInW87K1DN8UK7mhz8Fk=; b=hN1pIpVQxSX68B+5KR64u3t46cuKEHm2InJvCzeFLiyPbGxRJE4SFXHK1Z92q6l629 /Zy7hdyx9v3lkXwOod/ehdXIUjjWOWMvwSQDWGNBA/23i9oOpFh5zhr9TxQIr47+4HVi Xq0aVCGRmPZc6reAvyqycPWOpDYWicWIPbbxq2ISswj5xcwdg2VNxMHTXE/Lfi7OeqED OozYeIa3KpMq2mEyPBfdP4SlTbeHXvjwf1JuSVNuZVB098dVHTQYeNbKNfqbftwZJI6G tuK7tjMR3jfTEXz3BqdHniwLHJAEGDb//xRpHhtPr/cEEAMw00A558D2j183ukIM2/78 rf8w== X-Gm-Message-State: ANhLgQ3aOSqL+kyenq3BYmvvPDri3DtnrFsovCrArLcx0PQKWLJIeBXy MNC1BhL+ckPayLUEE2S2KWU5y3tYz9s= X-Google-Smtp-Source: ADFU+vupYFG88SCWtJut5fm/3oBhwgQRRF2B5wTF4FmaHOHoCB+3qm2YLfcQs0z+7tjTmIJlKft2zg== X-Received: by 2002:ae9:e51a:: with SMTP id w26mr332176qkf.312.1584471530901; Tue, 17 Mar 2020 11:58:50 -0700 (PDT) Received: from mango.spo.virtua.com.br ([2804:14c:81:942d::2]) by smtp.gmail.com with ESMTPSA id n190sm2414707qkb.93.2020.03.17.11.58.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Mar 2020 11:58:50 -0700 (PDT) From: Matheus Tavares To: git@vger.kernel.org Cc: gitster@pobox.com, dreamer.tan@gmail.com, peff@peff.net Subject: [PATCH v2 3/3] dir: update outdated comments about untracked cache Date: Tue, 17 Mar 2020 15:57:45 -0300 Message-Id: <544d625c471fd5d2d0e139dd0d48cf85d87f0cf8.1584471137.git.matheus.bernardino@usp.br> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In dir.h we have a comment mentioning "exclude_sha1[], info_exclude_sha1[] and excludes_file_sha1[]", but none of those names appears in code anymore. The first appearance of "info_exclude_sha1" and "excludes_file_sha1" in code happened in 83c094a ("untracked cache: save to an index extension", 2015-03-08). In this patch, the two names were added as fields of "struct ondisk_untracked_cache". Both fields were later removed, in 3899b88 ("dir: make untracked cache extension hash size independent", 2019-02-19). However, before their removal, we can see in dir.c:read_untracked_extension() that their data would be copied to the "struct untracked_cache". More specifically, to the now named "info_exclude_validity" and "excludes_file_validity" fields of the said struct. So it should be safe to say that what the comment referred to as "info_exclude_sha1[] and excludes_file_sha1[]", back then, could be updated to "info_exclude_validity.oid and excludes_file_validity.oid" nowadays. As for "exclude_sha1[]", its update is easier: it used to be a field of "struct untracked_cache_dir" that was renamed in 70c369c ("dir: convert struct untracked_cache_dir to object_id", 2018-05-02). This outdated field name is also mentioned in one more place: a dir.c comment about "struct write_data". So let's also update it there. Suggested-by: Patryk Obara Signed-off-by: Matheus Tavares --- dir.c | 3 ++- dir.h | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dir.c b/dir.c index 92226b1af2..3ad2d61278 100644 --- a/dir.c +++ b/dir.c @@ -2961,7 +2961,8 @@ struct write_data { int index; /* number of written untracked_cache_dir */ struct ewah_bitmap *check_only; /* from untracked_cache_dir */ struct ewah_bitmap *valid; /* from untracked_cache_dir */ - struct ewah_bitmap *sha1_valid; /* set if exclude_sha1 is not null */ + /* set if untracked_cache_dir.exclude_oid is not null */ + struct ewah_bitmap *sha1_valid; struct strbuf out; struct strbuf sb_stat; struct strbuf sb_sha1; diff --git a/dir.h b/dir.h index 6c3aaeba71..549e04b068 100644 --- a/dir.h +++ b/dir.h @@ -166,9 +166,10 @@ struct oid_stat { * Whenever a file (or a submodule) is added or removed from a * directory, we invalidate that directory. * - * The remaining inputs are easy, their SHA-1 could be used to verify - * their contents (exclude_sha1[], info_exclude_sha1[] and - * excludes_file_sha1[]) + * The remaining inputs are easy, their OID could be used to verify + * their contents (untracked_cache_dir.exclude_oid, + * untracked_cache.info_exclude_validity.oid and + * untracked_cache.excludes_file_validity.oid) */ struct untracked_cache_dir { struct untracked_cache_dir **dirs;