[PATCH 5/7] sha1_file: refuse to write tags referring to external objects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]