]> git.ipfire.org Git - thirdparty/git.git/commit - transport.h
builtin/clone.c: add --reject-shallow option
authorLi Linchao <lilinchao@oschina.cn>
Thu, 1 Apr 2021 10:46:59 +0000 (10:46 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 1 Apr 2021 19:58:58 +0000 (12:58 -0700)
commit4fe788b1b0ee6150173580d8fa70e7d5788cf7d3
tree6fb69c5ec68dcfa0bf1e0887726a99cc8749dfa5
parent84d06cdc06389ae7c462434cb7b1db0980f63860
builtin/clone.c: add --reject-shallow option

In some scenarios, users may want more history than the repository
offered for cloning, which happens to be a shallow repository, can
give them. But because users don't know it is a shallow repository
until they download it to local, we may want to refuse to clone
this kind of repository, without creating any unnecessary files.

The '--depth=x' option cannot be used as a solution; the source may
be deep enough to give us 'x' commits when cloned, but the user may
later need to deepen the history to arbitrary depth.

Teach '--reject-shallow' option to "git clone" to abort as soon as
we find out that we are cloning from a shallow repository.

Signed-off-by: Li Linchao <lilinchao@oschina.cn>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/config/clone.txt
Documentation/git-clone.txt
builtin/clone.c
fetch-pack.c
fetch-pack.h
t/t5601-clone.sh
t/t5606-clone-options.sh
t/t5611-clone-config.sh
transport.c
transport.h