Subject: [PATCH v2 7/8] mktag: refuse to write tags referring to external objects

From: Nguyễn Thái Ngọc Duy <[email-masked]>
Date: Tue, 30 Apr 2013 10:42:51 +0700

Signed-off-by: Nguyễn Thái Ngọc Duy <[email-masked]>
---
 builtin/mktag.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/builtin/mktag.c b/builtin/mktag.c
index 640ab64..2284280 100644
--- a/builtin/mktag.c
+++ b/builtin/mktag.c
@@ -23,7 +23,10 @@ static int verify_object(const unsigned char *sha1, const char *expected_type)
 	int ret = -1;
 	enum object_type type;
 	unsigned long size;
-	void *buffer = read_sha1_file(sha1, &type, &size);
+	void *buffer = read_sha1_file_extended(sha1,
+					       ODB_CACHED | ODB_LOCAL | ODB_ALT,
+					       &type, &size,
+					       READ_SHA1_FILE_REPLACE);
 	const unsigned char *repl = lookup_replace_object(sha1);
 
 	if (buffer) {
-- 
1.8.2.83.gc99314b