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

[PATCH] sha1_file: restore OBJECT_INFO_QUICK functionality

From
JTJonathan Tan <jonathantanmy@google.com>
Date
Mar 13, 2018, 15:30 UTC
Message-ID
<20180313153029.257296-1-jonathantanmy@google.com>
In-Reply-To
<xmqqr2ouwgsd.fsf@gitster-ct.c.googlers.com>

Support for the OBJECT_INFO_QUICK flag in sha1_object_info_extended() was added in commit dfdd4afcf9 ("sha1_file: teach sha1_object_info_extended more flags", 2017-06-26) in order to support commit e83e71c5e1 ("sha1_file: refactor has_sha1_file_with_flags", 2017-06-26), but it was inadvertently removed in commit 8b4c0103a9 ("sha1_file: support lazily fetching missing objects", 2017-12-08).

Restore this functionality.
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
---
Show 7 quoted lines
> Hmm, OBJECT_INFO_QUICK optimization was added in dfdd4afc
> ("sha1_file: teach sha1_object_info_extended more flags",
> 2017-06-21), but since 8b4c0103 ("sha1_file: support lazily fetching
> missing objects", 2017-12-08) it appears that passing
> OBJECT_INFO_QUICK down the codepath does not do anything
> interesting.  Jonathan (cc'ed), are all remaining hits from "git
> grep OBJECT_INFO_QUICK" all dead no-ops these days?
They are, but they are not supposed to be. Here is a patch correcting
that.
---
 sha1_file.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/sha1_file.c b/sha1_file.c
index 1b94f39c4..cc0f43ea8 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1267,9 +1267,11 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi,
 			return 0;
 
 		/* Not a loose object; someone else may have just packed it. */
-		reprepare_packed_git();
-		if (find_pack_entry(real, &e))
-			break;
+		if (!(flags & OBJECT_INFO_QUICK)) {
+			reprepare_packed_git();
+			if (find_pack_entry(real, &e))
+				break;
+		}
 
 		/* Check if it is a missing object */
 		if (fetch_if_missing && repository_format_partial_clone &&
-- 
2.16.2.660.g709887971b-goog
Previous: Junio C Hamano
Message 20 of 20 in “fetch-pack.c: use oidset to check existence of loose object”
  1. fetch-pack.c: use oidset to check existence of loose objectTakuto Ikuta, Mar 8, 2018
  2. René ScharfeMar 8, 2018
  3. Takuto IkutaMar 9, 2018
  4. Junio C HamanoMar 8, 2018
  5. 0/1 fetch-pack.c: use oidset to check existence of loose objectTakuto Ikuta, Mar 9, 2018
  6. 1/1 fetch-pack.c: use oidset to check existence of loose objectTakuto Ikuta, Mar 9, 2018
  7. fetch-pack.c: use oidset to check existence of loose objectTakuto Ikuta, Mar 9, 2018
  8. Junio C HamanoMar 9, 2018
  9. Takuto IkutaMar 10, 2018
  10. Junio C HamanoMar 13, 2018
  11. Takuto IkutaMar 14, 2018
  12. fetch-pack.c: use oidset to check existence of loose objectTakuto Ikuta, Mar 10, 2018
  13. fetch-pack.c: use oidset to check existence of loose objectTakuto Ikuta, Mar 10, 2018
  14. Junio C HamanoMar 13, 2018
  15. fetch-pack.c: use oidset to check existence of loose objectTakuto Ikuta, Mar 14, 2018
  16. fetch-pack.c: use oidset to check existence of loose objectTakuto Ikuta, Mar 14, 2018
  17. Takuto IkutaMar 9, 2018
  18. Junio C HamanoMar 9, 2018
  19. Junio C HamanoMar 9, 2018
  20. sha1_file: restore OBJECT_INFO_QUICK functionalityJonathan Tan, Mar 13, 2018

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.