summaryrefslogtreecommitdiff
path: root/transport.h
diff options
context:
space:
mode:
authorLi Linchao <lilinchao@oschina.cn>2021-04-01 10:46:59 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-04-01 19:58:58 (GMT)
commit4fe788b1b0ee6150173580d8fa70e7d5788cf7d3 (patch)
tree6fb69c5ec68dcfa0bf1e0887726a99cc8749dfa5 /transport.h
parent84d06cdc06389ae7c462434cb7b1db0980f63860 (diff)
downloadgit-4fe788b1b0ee6150173580d8fa70e7d5788cf7d3.zip
git-4fe788b1b0ee6150173580d8fa70e7d5788cf7d3.tar.gz
git-4fe788b1b0ee6150173580d8fa70e7d5788cf7d3.tar.bz2
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>
Diffstat (limited to 'transport.h')
-rw-r--r--transport.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/transport.h b/transport.h
index 24e1579..4d5db0a 100644
--- a/transport.h
+++ b/transport.h
@@ -14,6 +14,7 @@ struct git_transport_options {
unsigned check_self_contained_and_connected : 1;
unsigned self_contained_and_connected : 1;
unsigned update_shallow : 1;
+ unsigned reject_shallow : 1;
unsigned deepen_relative : 1;
/* see documentation of corresponding flag in fetch-pack.h */
@@ -194,6 +195,9 @@ void transport_check_allowed(const char *type);
/* Aggressively fetch annotated tags if possible */
#define TRANS_OPT_FOLLOWTAGS "followtags"
+/* Reject shallow repo transport */
+#define TRANS_OPT_REJECT_SHALLOW "rejectshallow"
+
/* Accept refs that may update .git/shallow without --depth */
#define TRANS_OPT_UPDATE_SHALLOW "updateshallow"