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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
Signed-off-by: Matheus Tavares <matheus.bernardino@xxxxxx>
---
 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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux