Skip to content

pr-865/Cactusinhand/git-clone-options-v3

From: lilinchao <lilinchao@oschina.cn>

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

Althought there is an option '--depth=x' for users to decide how
deep history they can fetch, but as the unshallow cloning's depth
is INFINITY, we can't know exactly the minimun 'x' value that can
satisfy the minimum integrity, so we can't pass 'x' value to --depth,
and expect this can obtain a complete history of a repository.

In other scenarios, given that we have an API that allow us to import
external repository, and then perform various operations on the repo.
But if the imported is a shallow one(which is actually possible), it
will affect the subsequent operations. So we can choose to refuse to
clone, and let's just import an unshallow repository.

This patch offers a new option '--reject-shallow' that can reject to
clone a shallow repository.

Signed-off-by: lilinchao <lilinchao@oschina.cn>

Submitted-As: https://lore.kernel.org/git/pull.865.v3.git.1612793576910.gitgitgadget@gmail.com
In-Reply-To: https://lore.kernel.org/git/pull.865.git.1612409491842.gitgitgadget@gmail.com
In-Reply-To: https://lore.kernel.org/git/pull.865.v2.git.1612773119.gitgitgadget@gmail.com
Assets 2