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

[PATCH 2/6] read-cache: convert to struct object_id

From
Patryk Obara <patryk.obara@gmail.com>
Date
Aug 20, 2017, 20:09 UTC
Message-ID
<27ec6a8d1b6fc49cadf7f9e7fed2c2605e02f626.1503258223.git.patryk.obara@gmail.com>
In-Reply-To
<cover.1503258223.git.patryk.obara@gmail.com>
Replace hashcmp with oidcmp.
Signed-off-by: Patryk Obara <patryk.obara@gmail.com>
---
 read-cache.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/read-cache.c b/read-cache.c
index acfb028..7285608 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -160,9 +160,9 @@ static int ce_compare_data(const struct cache_entry *ce, struct stat *st)
 	int fd = git_open_cloexec(ce->name, O_RDONLY);
 
 	if (fd >= 0) {
-		unsigned char sha1[20];
-		if (!index_fd(sha1, fd, st, OBJ_BLOB, ce->name, 0))
-			match = hashcmp(sha1, ce->oid.hash);
+		struct object_id oid;
+		if (!index_fd(oid.hash, fd, st, OBJ_BLOB, ce->name, 0))
+			match = oidcmp(&oid, &ce->oid);
 		/* index_fd() closed the file descriptor already */
 	}
 	return match;
-- 
2.9.5
Previous: brian m. carlsonNext: Patryk Obara
Message 7 of 10 in “Convert hash-object to struct object_id”
  1. 0/6 Convert hash-object to struct object_idPatryk Obara, Aug 20, 2017
  2. 1/6 builtin/hash-object: convert to struct object_idPatryk Obara, Aug 20, 2017
  3. 3/6 sha1_file: convert index_path to struct object_idPatryk Obara, Aug 20, 2017
  4. 6/6 sha1_file: convert index_stream to struct object_idPatryk Obara, Aug 20, 2017
  5. 5/6 sha1_file: convert hash_sha1_file_literally to struct object_idPatryk Obara, Aug 20, 2017
  6. brian m. carlsonAug 20, 2017
  7. 2/6 read-cache: convert to struct object_idPatryk Obara, Aug 20, 2017
  8. 4/6 sha1_file: convert index_fd to struct object_idPatryk Obara, Aug 20, 2017
  9. brian m. carlsonAug 20, 2017
  10. Junio C HamanoAug 21, 2017

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.