[PATCH v3 04/28] update-server-info: do not publish shallow clones

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

 



Dumb commit walker does not care about .git/shallow and until someone
steps up to make it happen, let's not publish shallow clones using
dumb protocols.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>
---
 server-info.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/server-info.c b/server-info.c
index 9ec744e..a8df6a5 100644
--- a/server-info.c
+++ b/server-info.c
@@ -33,6 +33,10 @@ static int update_info_refs(int force)
 	strcpy(path1 + len, "+");
 
 	safe_create_leading_directories(path0);
+	if (is_repository_shallow()) {
+		unlink(path0);
+		return error("info/refs not updated for shallow clone");
+	}
 	info_ref_fp = fopen(path1, "w");
 	if (!info_ref_fp)
 		return error("unable to update %s", path1);
@@ -217,6 +221,11 @@ static int update_info_packs(int force)
 	strcpy(name, infofile);
 	strcpy(name + namelen, "+");
 
+	if (is_repository_shallow()) {
+		unlink(infofile);
+		return error("info/packs not updated for shallow clone");
+	}
+
 	init_pack_info(infofile, force);
 
 	safe_create_leading_directories(name);
-- 
1.8.2.83.gc99314b

--
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]