summaryrefslogtreecommitdiff
path: root/builtin/send-pack.c
diff options
context:
space:
mode:
authorLibravatar Nguyễn Thái Ngọc Duy <pclouds@gmail.com>2013-12-05 20:02:30 +0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-12-10 16:14:16 -0800
commit0b854bcc2a3b34c09835393234cd807fde08722f (patch)
tree98d2f313e68985c1574668b6a34ac9dbef7eabd0 /builtin/send-pack.c
parentremote.h: replace struct extra_have_objects with struct sha1_array (diff)
downloadtgif-0b854bcc2a3b34c09835393234cd807fde08722f.tar.xz
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>
Diffstat (limited to 'builtin/send-pack.c')
-rw-r--r--builtin/send-pack.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/builtin/send-pack.c b/builtin/send-pack.c
index faaa603843..961df04dea 100644
--- a/builtin/send-pack.c
+++ b/builtin/send-pack.c
@@ -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)) {