From: Nguyễn Thái Ngọc Duy Date: Thu, 24 Jan 2013 08:42:18 GMT Subject: [PATCH 5/7] sha1_file: refuse to write tags referring to external objects Message-ID: <1359016940-18849-5-git-send-email-pclouds@gmail.com> In-Reply-To: <1359016940-18849-1-git-send-email-pclouds@gmail.com> Signed-off-by: Nguyễn Thái Ngọc Duy --- sha1_file.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sha1_file.c b/sha1_file.c index ec3a040..01681e5 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -2666,6 +2666,12 @@ static void check_sha1_file_for_external_source(const char *buf, sha1_to_hex(entry.sha1)); break; } + } else if (!strcmp(type, "tag")) { + if (get_sha1_hex(buf + 7, sha1) < 0 || + sha1_object_info_extended(sha1, &oi) != OBJ_TREE || + (oi.alt && oi.alt->external)) + die("cannot create a tag with external tree %s", + sha1_to_hex(sha1)); } } -- 1.8.0.rc3.18.g0d9b108