git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 3/3] dir: update outdated comments about untracked cache

From
Matheus Tavares <matheus.bernardino@usp.br>
Date
Mar 17, 2020, 18:57 UTC
Message-ID
<544d625c471fd5d2d0e139dd0d48cf85d87f0cf8.1584471137.git.matheus.bernardino@usp.br>
In-Reply-To
<cover.1584471137.git.matheus.bernardino@usp.br>

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 <dreamer.tan@gmail.com>
Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
---
 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;
-- 
2.25.1
Previous: Matheus Tavares
Message 13 of 13 in “dir: update outdated fields and comments about oid_stat”
  1. 0/2 dir: update outdated fields and comments about oid_statMatheus Tavares, Mar 16, 2020
  2. 1/2 dir: fix outdated comment on add_patterns()Matheus Tavares, Mar 16, 2020
  3. 2/2 dir: improve naming of oid_stat fields in two structsMatheus Tavares, Mar 16, 2020
  4. Junio C HamanoMar 16, 2020
  5. Patryk ObaraMar 16, 2020
  6. Matheus Tavares BernardinoMar 16, 2020
  7. Junio C HamanoMar 16, 2020
  8. Junio C HamanoMar 16, 2020
  9. Jeff KingMar 16, 2020
  10. 0/3 dir: update outdated field names and comments about oid_statMatheus Tavares, Mar 17, 2020
  11. 1/3 dir: fix outdated comment on add_patterns()Matheus Tavares, Mar 17, 2020
  12. 2/3 dir: improve naming of oid_stat fields in two structsMatheus Tavares, Mar 17, 2020
  13. 3/3 dir: update outdated comments about untracked cacheMatheus Tavares, Mar 17, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.