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

[PATCH v3 04/10] Add an "unsigned flags" parameter to sha1_object_info_extended()

From
Christian Couder <chriscool@tuxfamily.org>
Date
Dec 11, 2013, 07:46 UTC
Message-ID
<20131211074614.11117.92650.chriscool@tuxfamily.org>
In-Reply-To
<20131211074147.11117.1155.chriscool@tuxfamily.org>

This parameter is not used yet, but it will be used to tell sha1_object_info_extended() if it should perform object replacement or not.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 builtin/cat-file.c | 2 +-
 cache.h            | 2 +-
 sha1_file.c        | 6 +++---
 streaming.c        | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index b2ca775..b15c064 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -238,7 +238,7 @@ static int batch_one_object(const char *obj_name, struct batch_options *opt,
 		return 0;
 	}
 
-	if (sha1_object_info_extended(data->sha1, &data->info) < 0) {
+	if (sha1_object_info_extended(data->sha1, &data->info, LOOKUP_REPLACE_OBJECT) < 0) {
 		printf("%s missing\n", obj_name);
 		fflush(stdout);
 		return 0;
diff --git a/cache.h b/cache.h
index 563f85f..701e42c 100644
--- a/cache.h
+++ b/cache.h
@@ -1104,7 +1104,7 @@ struct object_info {
 		} packed;
 	} u;
 };
-extern int sha1_object_info_extended(const unsigned char *, struct object_info *);
+extern int sha1_object_info_extended(const unsigned char *, struct object_info *, unsigned flags);
 
 /* Dumb servers support */
 extern int update_server_info(int);
diff --git a/sha1_file.c b/sha1_file.c
index 4fb2f17..482037e 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -2443,7 +2443,7 @@ static int sha1_loose_object_info(const unsigned char *sha1,
 	return 0;
 }
 
-int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi)
+int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi, unsigned flags)
 {
 	struct cached_object *co;
 	struct pack_entry e;
@@ -2477,7 +2477,7 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi)
 	rtype = packed_object_info(e.p, e.offset, oi);
 	if (rtype < 0) {
 		mark_bad_packed_object(e.p, sha1);
-		return sha1_object_info_extended(sha1, oi);
+		return sha1_object_info_extended(sha1, oi, 0);
 	} else if (in_delta_base_cache(e.p, e.offset)) {
 		oi->whence = OI_DBCACHED;
 	} else {
@@ -2499,7 +2499,7 @@ int sha1_object_info(const unsigned char *sha1, unsigned long *sizep)
 
 	oi.typep = &type;
 	oi.sizep = sizep;
-	if (sha1_object_info_extended(sha1, &oi) < 0)
+	if (sha1_object_info_extended(sha1, &oi, LOOKUP_REPLACE_OBJECT) < 0)
 		return -1;
 	return type;
 }
diff --git a/streaming.c b/streaming.c
index debe904..9659f18 100644
--- a/streaming.c
+++ b/streaming.c
@@ -113,7 +113,7 @@ static enum input_source istream_source(const unsigned char *sha1,
 
 	oi->typep = type;
 	oi->sizep = &size;
-	status = sha1_object_info_extended(sha1, oi);
+	status = sha1_object_info_extended(sha1, oi, 0);
 	if (status < 0)
 		return stream_error;
 
-- 
1.8.5.1.102.g090758b
Previous: Christian CouderNext: Christian Couder
Message 5 of 20 in “teach replace objects to sha1_object_info_extended()”
  1. 00/10 teach replace objects to sha1_object_info_extended()Christian Couder, Dec 11, 2013
  2. 01/10 Rename READ_SHA1_FILE_REPLACE flag to LOOKUP_REPLACE_OBJECTChristian Couder, Dec 11, 2013
  3. 02/10 replace_object: don't check read_replace_refs twiceChristian Couder, Dec 11, 2013
  4. 03/10 Introduce lookup_replace_object_extended() to pass flagsChristian Couder, Dec 11, 2013
  5. 04/10 Add an "unsigned flags" parameter to sha1_object_info_extended()Christian Couder, Dec 11, 2013
  6. 05/10 t6050: show that git cat-file --batch fails with replace objectsChristian Couder, Dec 11, 2013
  7. 06/10 sha1_file: perform object replacement in sha1_object_info_extended()Christian Couder, Dec 11, 2013
  8. 07/10 builtin/replace: teach listing using short, medium or full formatsChristian Couder, Dec 11, 2013
  9. Karsten BleesDec 18, 2013
  10. Christian CouderDec 18, 2013
  11. Junio C HamanoDec 18, 2013
  12. Christian CouderDec 19, 2013
  13. Junio C HamanoDec 19, 2013
  14. Christian CouderDec 21, 2013
  15. Junio C HamanoDec 26, 2013
  16. Christian CouderDec 28, 2013
  17. 08/10 t6050: add tests for listing with --formatChristian Couder, Dec 11, 2013
  18. 09/10 builtin/replace: unset read_replace_refsChristian Couder, Dec 11, 2013
  19. 10/10 Documentation/git-replace: describe --format optionChristian Couder, Dec 11, 2013
  20. Junio C HamanoDec 12, 2013

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.