send-pack: forbid pushing from a shallow repository

send-pack can send a pack with loose ends to the server. receive-pack before 6d4bb38 (fetch: verify we have everything we need before updating our ref - 2011-09-01) does not detect this and keeps the pack anyway, which corrupts the repository, at least from fsck point of view. send-pack will learn to safely push from a shallow repository later. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Dec 5, 2013 at 20:02 UTC 0b854bcc2a3b34c09835393234cd807fde08722f
1 file changed +3
builtin/send-pack.c
+3
@@ -208,6 +208,9 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
208 (send_all && args.send_mirror))
209 usage(send_pack_usage);
210
211 + if (is_repository_shallow())
212 + die("attempt to push from a shallow repository");
213 +
214 if (remote_name) {
215 remote = remote_get(remote_name);
216 if (!remote_has_url(remote, dest)) {