Skip to content

Commit

Permalink
send-pack: forbid pushing from a shallow repository
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Nguyễn Thái Ngọc Duy authored and Junio C Hamano committed Dec 11, 2013
1 parent 13eb462 commit 0b854bc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions builtin/send-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 0b854bc

Please sign in to comment.