From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 18/20] clone: define shallow clone boundary with --not
Date: Tue, 29 Dec 2015 19:10:41 +0700 [thread overview]
Message-ID: <1451391043-28093-19-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1451391043-28093-1-git-send-email-pclouds@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
Documentation/git-clone.txt | 5 +++++
builtin/clone.c | 18 +++++++++++++++++-
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
index 28993c6..3589e57 100644
--- a/Documentation/git-clone.txt
+++ b/Documentation/git-clone.txt
@@ -195,6 +195,11 @@ objects from the source repository into a pack in the cloned repository.
--since=<date>::
Create a 'shallow' clone with a history after the specified time.
+--not=<revision>::
+ Create a 'shallow' clone with a history, excluding commits
+ reachable from a specified remote branch or tag. This option
+ can be specified multiple times.
+
--[no-]single-branch::
Clone only the history leading to the tip of a single branch,
either specified by the `--branch` option or the primary
diff --git a/builtin/clone.c b/builtin/clone.c
index 94bbfef..0e99354 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -44,6 +44,7 @@ static int deepen;
static char *option_template, *option_depth, *option_since;
static char *option_origin = NULL;
static char *option_branch = NULL;
+static struct string_list option_not = STRING_LIST_INIT_NODUP;
static const char *real_git_dir;
static char *option_upload_pack = "git-upload-pack";
static int option_verbosity;
@@ -52,6 +53,13 @@ static struct string_list option_config;
static struct string_list option_reference;
static int option_dissociate;
+static int option_parse_deepen_not(const struct option *opt,
+ const char *arg, int unset)
+{
+ string_list_append(&option_not, arg);
+ return 0;
+}
+
static struct option builtin_clone_options[] = {
OPT__VERBOSITY(&option_verbosity),
OPT_BOOL(0, "progress", &option_progress,
@@ -89,6 +97,9 @@ static struct option builtin_clone_options[] = {
N_("create a shallow clone of that depth")),
OPT_STRING(0, "since", &option_since, N_("time"),
N_("create a shallow clone since a specific time")),
+ { OPTION_CALLBACK, 0, "not", NULL, N_("revision"),
+ N_("deepen history of shallow clone by excluding rev"),
+ PARSE_OPT_NONEG, option_parse_deepen_not },
OPT_BOOL(0, "single-branch", &option_single_branch,
N_("clone only one branch, HEAD or --branch")),
OPT_STRING(0, "separate-git-dir", &real_git_dir, N_("gitdir"),
@@ -849,7 +860,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
usage_msg_opt(_("You must specify a repository to clone."),
builtin_clone_usage, builtin_clone_options);
- if (option_depth || option_since)
+ if (option_depth || option_since || option_not.nr)
deepen = 1;
if (option_single_branch == -1)
option_single_branch = deepen ? 1 : 0;
@@ -980,6 +991,8 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
warning(_("--depth is ignored in local clones; use file:// instead."));
if (option_since)
warning(_("--since is ignored in local clones; use file:// instead."));
+ if (option_not.nr)
+ warning(_("--not is ignored in local clones; use file:// instead."));
if (!access(mkpath("%s/shallow", path), F_OK)) {
if (option_local > 0)
warning(_("source repository is shallow, ignoring --local"));
@@ -1001,6 +1014,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
if (option_since)
transport_set_option(transport, TRANS_OPT_DEEPEN_SINCE,
option_since);
+ if (option_not.nr)
+ transport_set_option(transport, TRANS_OPT_DEEPEN_NOT,
+ (const char *)&option_not);
if (option_single_branch)
transport_set_option(transport, TRANS_OPT_FOLLOWTAGS, "1");
--
2.3.0.rc1.137.g477eb31
next prev parent reply other threads:[~2015-12-29 12:12 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-29 12:10 [PATCH 00/20] More flexibility in making shallow clones Nguyễn Thái Ngọc Duy
2015-12-29 12:10 ` [PATCH 01/20] upload-pack: move shallow deepen code out of receive_needs() Nguyễn Thái Ngọc Duy
2015-12-29 12:10 ` [PATCH 02/20] upload-pack: move "shallow" sending code out of deepen() Nguyễn Thái Ngọc Duy
2015-12-29 12:10 ` [PATCH 03/20] upload-pack: remove unused variable "backup" Nguyễn Thái Ngọc Duy
2015-12-29 12:10 ` [PATCH 04/20] upload-pack: move "unshallow" sending code out of deepen() Nguyễn Thái Ngọc Duy
2015-12-29 12:10 ` [PATCH 05/20] shallow.c: implement a generic shallow boundary finder based on rev-list Nguyễn Thái Ngọc Duy
2015-12-29 12:10 ` [PATCH 06/20] upload-pack: glue code to use get_shallow_commits_by_rev_list Nguyễn Thái Ngọc Duy
2015-12-29 12:10 ` [PATCH 07/20] upload-pack: use skip_prefix() instead of starts_with() when possible Nguyễn Thái Ngọc Duy
2015-12-29 12:10 ` [PATCH 08/20] upload-pack: tighten number parsing at "deepen" lines Nguyễn Thái Ngọc Duy
2015-12-29 12:10 ` [PATCH 09/20] upload-pack: add deepen-since to cut shallow repos based on time Nguyễn Thái Ngọc Duy
2015-12-29 12:10 ` [PATCH 10/20] fetch-pack: use a common function for verbose printing Nguyễn Thái Ngọc Duy
2015-12-29 12:10 ` [PATCH 11/20] fetch-pack: use a separate flag for fetch in deepening mode Nguyễn Thái Ngọc Duy
2015-12-29 12:10 ` [PATCH 12/20] fetch: define shallow boundary with --since Nguyễn Thái Ngọc Duy
2015-12-29 12:10 ` [PATCH 13/20] clone: define shallow clone boundary based on time " Nguyễn Thái Ngọc Duy
2015-12-29 12:10 ` [PATCH 14/20] Add test_repo_expect_success for running tests in a new repository Nguyễn Thái Ngọc Duy
2015-12-29 14:12 ` Duy Nguyen
2015-12-29 12:10 ` [PATCH 15/20] t5500: test for shallow depth since a specific date Nguyễn Thái Ngọc Duy
2015-12-29 12:10 ` [PATCH 16/20] upload-pack: support define shallow boundary by excluding revisions Nguyễn Thái Ngọc Duy
2015-12-29 12:10 ` [PATCH 17/20] fetch: define shallow boundary with --not Nguyễn Thái Ngọc Duy
2015-12-29 12:10 ` Nguyễn Thái Ngọc Duy [this message]
2015-12-29 12:10 ` [PATCH 19/20] t5500: test for shallow depth excluding a ref Nguyễn Thái Ngọc Duy
2015-12-29 12:10 ` [PATCH 20/20] fetch: add --deepen=<N> to extend shallow boundary by <N> commits Nguyễn Thái Ngọc Duy
2016-01-04 9:45 ` Eric Sunshine
2015-12-29 19:09 ` [PATCH 00/20] More flexibility in making shallow clones Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1451391043-28093-19-git-send-email-pclouds@gmail.com \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).