send-pack: forbid pushing from a shallow repository
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Thu, 5 Dec 2013 13:02:30 +0000 (20:02 +0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 11 Dec 2013 00:14:16 +0000 (16:14 -0800)
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>
builtin/send-pack.c
index faaa603843975aa41c0e8aa6fc270017405f3375..961df04deaf9497074db9f5ad1790962cd67e402 100644 (file)
@@ -208,6 +208,9 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
            (send_all && args.send_mirror))
                usage(send_pack_usage);
 
+       if (is_repository_shallow())
+               die("attempt to push from a shallow repository");
+
        if (remote_name) {
                remote = remote_get(remote_name);
                if (!remote_has_url(remote, dest)) {