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

Re: sha-1 check in rev-list --verify-objects redundant?

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
Feb 27, 2012, 13:01 UTC
Message-ID
<20120227130141.GA8980@do>
In-Reply-To
<CACsJy8BUeedTZSq_ay=JmqUt3wrnm6n1eOcFt0WPkEo2B-1zwA@mail.gmail.com>
On Sun, Feb 26, 2012 at 06:11:30PM +0700, Nguyen Thai Ngoc Duy wrote:
> "rev-list --objects" does check for blob existence, in finish_object().

Eck.. I think "--quiet --verify-objects" becomes "--quiet --objects" because of this code:

-- 8< --
	traverse_commit_list(&revs,
			     quiet ? finish_commit : show_commit,
			     quiet ? finish_object : show_object,
			     &info);
-- 8< --

Unless that's intentional, shouldn't we apply this patch? --quiet's interfering with rev-list's business sounds weird to me.

-- 8< --
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index 264e3ae..95fb605 100644
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
@@ -172,19 +172,18 @@ static void finish_object(struct object *obj,
 			  const struct name_path *path, const char *name,
 			  void *cb_data)
 {
+	struct rev_list_info *info = cb_data;
 	if (obj->type == OBJ_BLOB && !has_sha1_file(obj->sha1))
 		die("missing blob object '%s'", sha1_to_hex(obj->sha1));
+	if (info->revs->verify_objects && !obj->parsed && obj->type != OBJ_COMMIT)
+		parse_object(obj->sha1);
 }
 
 static void show_object(struct object *obj,
 			const struct name_path *path, const char *component,
 			void *cb_data)
 {
-	struct rev_list_info *info = cb_data;
-
 	finish_object(obj, path, component, cb_data);
-	if (info->revs->verify_objects && !obj->parsed && obj->type != OBJ_COMMIT)
-		parse_object(obj->sha1);
 	show_object_with_name(stdout, obj, path, component);
 } 
-- 8< --
-- 
Duy
Previous: Junio C HamanoNext: Junio C Hamano
Message 8 of 9 in “sha-1 check in rev-list --verify-objects redundant?”
  1. Nguyen Thai Ngoc DuyFeb 25, 2012
  2. Junio C HamanoFeb 26, 2012
  3. Junio C HamanoFeb 26, 2012
  4. Nguyen Thai Ngoc DuyFeb 26, 2012
  5. Junio C HamanoFeb 26, 2012
  6. Nguyen Thai Ngoc DuyFeb 27, 2012
  7. Junio C HamanoFeb 27, 2012
  8. Nguyen Thai Ngoc DuyFeb 27, 2012
  9. Junio C HamanoFeb 27, 2012

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.