Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e3912be
dir: refactor add_excludes()
jeffhostetler Jun 29, 2017
3d1ea35
list-objects-filter-map: extend oidmap
jeffhostetler Oct 16, 2017
8cc9b26
list-objects: filter objects in traverse_commit_list
jeffhostetler Jun 30, 2017
e429fa5
list-objects-filter-blobs-none: add filter to omit all blobs
jeffhostetler Sep 1, 2017
5e9c75e
list-objects-filter-blobs-limit: add large blob filtering
jeffhostetler Sep 1, 2017
c4cc54e
list-objects-filter-sparse: add sparse filter
jeffhostetler Sep 1, 2017
1042b20
list-objects-filter-options: common argument parsing
jeffhostetler Jul 6, 2017
714c077
list-objects: add traverse_commit_list_filtered method
jeffhostetler Sep 1, 2017
9ffafbb
extension.partialclone: introduce partial clone extension
jeffhostetler Oct 17, 2017
db7c198
rev-list: add list-objects filtering support
jeffhostetler Jun 30, 2017
5c04cf1
t6112: rev-list object filtering test
jeffhostetler Jun 30, 2017
eb1ea18
pack-objects: add list-objects filtering
jeffhostetler Sep 7, 2017
9e8eccb
t5317: pack-objects object filtering test
jeffhostetler Oct 16, 2017
75222b3
pack-protocol: document list-objects filtering
jeffhostetler Sep 7, 2017
200d6c9
upload-pack: add list-objects filtering
jeffhostetler Sep 7, 2017
e81a22d
transport: add list-objects filtering
jeffhostetler Sep 7, 2017
9d84984
transport-helper: add object filtering for partial clone
jeffhostetler Oct 18, 2017
4d56a20
index-pack: respect extension.partialClone
jeffhostetler Sep 7, 2017
bf537f4
fetch-pack: add list-objects filtering
jeffhostetler Sep 7, 2017
8a645fc
clone: add list-objects filtering
jeffhostetler Sep 7, 2017
50d4e91
clone: set extensions.partialclone during partial clone
jeffhostetler Oct 18, 2017
09a1a77
fetch: refactor calculation of remote list
jonathantanmy Sep 29, 2017
56653cd
fetch: add list-objects filtering parameters
jeffhostetler Sep 7, 2017
503fb50
remote-curl: add object filtering for partial clone
jeffhostetler Oct 18, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Documentation/git-pack-objects.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ SYNOPSIS
'git pack-objects' [-q | --progress | --all-progress] [--all-progress-implied]
[--no-reuse-delta] [--delta-base-offset] [--non-empty]
[--local] [--incremental] [--window=<n>] [--depth=<n>]
[--revs [--unpacked | --all]] [--stdout | base-name]
[--revs [--unpacked | --all]]
[--stdout [--filter=<filter-spec>] | base-name]
[--shallow] [--keep-true-parents] < object-list


Expand Down Expand Up @@ -236,6 +237,11 @@ So does `git bundle` (see linkgit:git-bundle[1]) when it creates a bundle.
With this option, parents that are hidden by grafts are packed
nevertheless.

--filter=<filter-spec>::
Requires `--stdout`. Omits certain objects (usually blobs) from
the resulting packfile. See linkgit:git-rev-list[1] for valid
`<filter-spec>` forms.

SEE ALSO
--------
linkgit:git-rev-list[1]
Expand Down
5 changes: 4 additions & 1 deletion Documentation/git-rev-list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ SYNOPSIS
[ --fixed-strings | -F ]
[ --date=<format>]
[ [ --objects | --objects-edge | --objects-edge-aggressive ]
[ --unpacked ] ]
[ --unpacked ]
[ --filter=<filter-spec> ] ]
[ --filter-print-missing ]
[ --filter-print-omitted ]
[ --pretty | --header ]
[ --bisect ]
[ --bisect-vars ]
Expand Down
30 changes: 30 additions & 0 deletions Documentation/rev-list-options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,36 @@ ifdef::git-rev-list[]
--unpacked::
Only useful with `--objects`; print the object IDs that are not
in packs.

--filter=<filter-spec>::
Only useful with one of the `--objects*`; omits objects (usually
blobs) from the list of printed objects. The '<filter-spec>'
may be one of the following:
+
The form '--filter=blob:none' omits all blobs.
+
The form '--filter=blob:limit=<n>[kmg]' omits blobs larger than n bytes
or units. The value may be zero. Special files matching '.git*' are
alwayse included, regardless of size.
+
The form '--filter=sparse:oid=<oid-ish>' uses a sparse-checkout
specification contained in the object (or the object that the expression
evaluates to) to omit blobs not required by the corresponding sparse
checkout.
+
The form '--filter=sparse:path=<path>' similarly uses a sparse-checkout
specification contained in <path>.

--filter-print-missing::
Prints a list of the missing objects for the requested traversal.
Object IDs are prefixed with a ``?'' character. The object type
is printed after the ID. This may be used with or without any of
the above filtering options.

--filter-print-omitted::
Only useful with one of the above `--filter*`; prints a list
of the omitted objects. Object IDs are prefixed with a ``~''
character.
endif::git-rev-list[]

--no-walk[=(sorted|unsorted)]::
Expand Down
9 changes: 9 additions & 0 deletions Documentation/technical/pack-protocol.txt
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ out of what the server said it could do with the first 'want' line.
upload-request = want-list
*shallow-line
*1depth-request
[filter-request]
flush-pkt

want-list = first-want
Expand All @@ -227,6 +228,8 @@ out of what the server said it could do with the first 'want' line.
additional-want = PKT-LINE("want" SP obj-id)

depth = 1*DIGIT

filter-request = PKT-LINE("filter" SP "filter-spec")
----

Clients MUST send all the obj-ids it wants from the reference
Expand All @@ -249,6 +252,12 @@ complete those commits. Commits whose parents are not received as a
result are defined as shallow and marked as such in the server. This
information is sent back to the client in the next step.

The client can optionally request that pack-objects omit various
objects from the packfile using one of several filtering techniques.
These are intended for use with partial clone/fetch operations.
The value of "filter-spec" is passed by upload-pack to pack-objects
using the `--filter=<filter-spec>` parameter.

Once all the 'want's and 'shallow's (and optional 'deepen') are
transferred, clients MUST send a flush-pkt, to tell the server side
that it is done sending the list.
Expand Down
8 changes: 8 additions & 0 deletions Documentation/technical/protocol-capabilities.txt
Original file line number Diff line number Diff line change
Expand Up @@ -309,3 +309,11 @@ to accept a signed push certificate, and asks the <nonce> to be
included in the push certificate. A send-pack client MUST NOT
send a push-cert packet unless the receive-pack server advertises
this capability.

filter-objects
--------------

If the upload-pack server advertises the 'filter' capability,
fetch-pack may send a "filter <filter-spec>" command to request
a partial clone or fetch where the server omits various objects
from the packfile.
22 changes: 22 additions & 0 deletions Documentation/technical/repository-version.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,25 @@ for testing format-1 compatibility.
When the config key `extensions.preciousObjects` is set to `true`,
objects in the repository MUST NOT be deleted (e.g., by `git-prune` or
`git repack -d`).

`partialcloneremote`
~~~~~~~~~~~~~~~~~~~~

When the config key `extensions.partialcloneremote` is set, it indicates
that the repo was created with a partial clone (or later performed
a partial fetch) and that the remote may have omitted sending
certain unwanted objects. Such a remote is called a "promisor remote"
and it promises that all such omitted objects can be fetched from it
in the future.

The value of this key is the name of the promisor remote.

`partialclonefilter`
~~~~~~~~~~~~~~~~~~~~

When the config key `extensions.partialclonefilter` is set, it gives
the initial filter expression used to create the partial clone.
This value becomed the default filter expression for subsequent
fetches (called "partial fetches") from the promisor remote. This
value may also be set by the first explicit partial fetch following a
normal clone.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,11 @@ LIB_OBJS += levenshtein.o
LIB_OBJS += line-log.o
LIB_OBJS += line-range.o
LIB_OBJS += list-objects.o
LIB_OBJS += list-objects-filter-blobs-limit.o
LIB_OBJS += list-objects-filter-blobs-none.o
LIB_OBJS += list-objects-filter-map.o
LIB_OBJS += list-objects-filter-options.o
LIB_OBJS += list-objects-filter-sparse.o
LIB_OBJS += ll-merge.o
LIB_OBJS += lockfile.o
LIB_OBJS += log-tree.o
Expand Down Expand Up @@ -836,6 +841,7 @@ LIB_OBJS += pack-write.o
LIB_OBJS += pager.o
LIB_OBJS += parse-options.o
LIB_OBJS += parse-options-cb.o
LIB_OBJS += partial-clone-utils.o
LIB_OBJS += patch-delta.o
LIB_OBJS += patch-ids.o
LIB_OBJS += path.o
Expand Down
18 changes: 16 additions & 2 deletions builtin/clone.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "run-command.h"
#include "connected.h"
#include "packfile.h"
#include "partial-clone-utils.h"

/*
* Overall FIXMEs:
Expand Down Expand Up @@ -60,6 +61,7 @@ static struct string_list option_optional_reference = STRING_LIST_INIT_NODUP;
static int option_dissociate;
static int max_jobs = -1;
static struct string_list option_recurse_submodules = STRING_LIST_INIT_NODUP;
static struct list_objects_filter_options filter_options;

static int recurse_submodules_cb(const struct option *opt,
const char *arg, int unset)
Expand Down Expand Up @@ -135,6 +137,7 @@ static struct option builtin_clone_options[] = {
TRANSPORT_FAMILY_IPV4),
OPT_SET_INT('6', "ipv6", &family, N_("use IPv6 addresses only"),
TRANSPORT_FAMILY_IPV6),
OPT_PARSE_LIST_OBJECTS_FILTER(&filter_options),
OPT_END()
};

Expand Down Expand Up @@ -1073,6 +1076,8 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
warning(_("--shallow-since is ignored in local clones; use file:// instead."));
if (option_not.nr)
warning(_("--shallow-exclude is ignored in local clones; use file:// instead."));
if (filter_options.choice)
warning(_("Partial clone 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"));
Expand Down Expand Up @@ -1104,7 +1109,11 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
transport_set_option(transport, TRANS_OPT_UPLOADPACK,
option_upload_pack);

if (transport->smart_options && !deepen)
if (filter_options.choice)
transport_set_option(transport, TRANS_OPT_LIST_OBJECTS_FILTER,
filter_options.raw_value);

if (transport->smart_options && !deepen && !filter_options.choice)
transport->smart_options->check_self_contained_and_connected = 1;

refs = transport_get_remote_refs(transport);
Expand Down Expand Up @@ -1164,13 +1173,18 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
write_refspec_config(src_ref_prefix, our_head_points_at,
remote_head_points_at, &branch_top);

if (filter_options.choice)
partial_clone_utils_register(&filter_options, "origin",
"clone");

if (is_local)
clone_local(path, git_dir);
else if (refs && complete_refs_before_fetch)
transport_fetch_refs(transport, mapped_refs);

update_remote_refs(refs, mapped_refs, remote_head_points_at,
branch_top.buf, reflog_msg.buf, transport, !is_local);
branch_top.buf, reflog_msg.buf, transport,
!is_local && !filter_options.choice);

update_head(our_head_points_at, remote_head, reflog_msg.buf);

Expand Down
5 changes: 5 additions & 0 deletions builtin/fetch-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
args.update_shallow = 1;
continue;
}
if (skip_prefix(arg, ("--" CL_ARG__FILTER "="), &arg)) {
parse_list_objects_filter(&args.filter_options, arg);
continue;
}

usage(fetch_pack_usage);
}
if (deepen_not.nr)
Expand Down
Loading