Re: [PATCH 40/44] packfile: allow prepare_packed_git to handle arbitrary repositories

2018-03-21 Thread Brandon Williams
seen_bits, const char *path); > > -#define prepare_packed_git(r) prepare_packed_git_##r() > -extern void prepare_packed_git_the_repository(void); > +extern void prepare_packed_git(struct repository *r); > #define reprepare_packed_git(r) reprepare_packed_git_##r() > extern void reprepare_packed_git_the_repository(void); > extern void install_packed_git(struct repository *r, struct packed_git > *pack); > -- > 2.16.1.435.g8f24da2e1a > -- Brandon Williams

Re: [PATCH 32/44] sha1_file: allow sha1_loose_object_info to handle arbitrary repositories

2018-03-21 Thread Brandon Williams
return -1; > if (oi->disk_sizep) > *oi->disk_sizep = st.st_size; > return 0; > } > > - map = map_sha1_file(the_repository, sha1, ); > + map = map_sha1_file(r, sha1, ); > if (!map) > return -1; > > -- > 2.16.1.435.g8f24da2e1a > -- Brandon Williams

Re: [PATCH 19/44] sha1_file: allow link_alt_odb_entries to handle arbitrary repositories

2018-03-21 Thread Brandon Williams
t; -static void read_info_alternates_the_repository(const char *relative_base, > - int depth) > +static void read_info_alternates(struct repository *r, > + const char *relative_base, > + int depth) > { > char *path; > struct strbuf buf = STRBUF_INIT; > @@ -516,7 +512,7 @@ static void read_info_alternates_the_repository(const > char *relative_base, > return; > } > > - link_alt_odb_entries(the_repository, buf.buf, '\n', relative_base, > depth); > + link_alt_odb_entries(r, buf.buf, '\n', relative_base, depth); > strbuf_release(); > free(path); > } > -- > 2.16.1.435.g8f24da2e1a > -- Brandon Williams

Re: [PATCH 13/44] pack: move approximate object count to object store

2018-03-21 Thread Brandon Williams
the_repository->objects.approximate_object_count_valid = 0; > > > > Not an issue specific to this patch, but where, how, when does > > 'approximate_object_count_valid' ever get set to anything other than > > 0? Even in the existing code (without this patch), there doesn't seem > > to be anyplace which sets this to a non-zero value. Am I missing > > something obvious (or subtle)? > > Probably related to this > https://public-inbox.org/git/20180226085508.ga30...@sigill.intra.peff.net/#t Yeah as far as doing a conversion this should be fine, we can come by and clean it up at a later point. -- Brandon Williams

Re: [PATCH 12/44] pack: move prepare_packed_git_run_once to object store

2018-03-21 Thread Brandon Williams
tory->objects.packed_git_initialized = 1; > } > > void reprepare_packed_git(void) > { > approximate_object_count_valid = 0; > - prepare_packed_git_run_once = 0; > + the_repository->objects.packed_git_initialized = 0; > prepare_packed_git(); > } > > -- > 2.16.1.435.g8f24da2e1a > -- Brandon Williams

Re: [PATCH 11/44] object-store: close all packs upon clearing the object store

2018-03-21 Thread Brandon Williams
o close pack marked 'do-not-close'"); > else > diff --git a/packfile.h b/packfile.h > index 76496226bb..5b1ce00f84 100644 > --- a/packfile.h > +++ b/packfile.h > @@ -66,7 +66,7 @@ extern void close_pack_index(struct packed_git *); > > extern unsigned char *use_pack(struct packed_git *, struct pack_window **, > off_t, unsigned long *); > extern void close_pack_windows(struct packed_git *); > -extern void close_all_packs(void); > +extern void close_all_packs(struct raw_object_store *o); > extern void unuse_pack(struct pack_window **); > extern void clear_delta_base_cache(void); > extern struct packed_git *add_packed_git(const char *path, size_t path_len, > int local); > -- > 2.16.1.435.g8f24da2e1a > -- Brandon Williams

Re: [PATCH 10/44] object-store: move packed_git and packed_git_mru to object store

2018-03-21 Thread Brandon Williams
t; void *data, unsigned flags) > int pack_errors = 0; > > prepare_packed_git(); > - for (p = packed_git; p; p = p->next) { > + for (p = the_repository->objects.packed_git; p; p = p->next) { > if ((flags & FOR_EACH_OBJECT_LOCAL_ONLY) && !p->pack_local) > continue; > if ((flags & FOR_EACH_OBJECT_PROMISOR_ONLY) && > diff --git a/packfile.h b/packfile.h > index a7fca598d6..76496226bb 100644 > --- a/packfile.h > +++ b/packfile.h > @@ -38,6 +38,9 @@ extern void prepare_packed_git(void); > extern void reprepare_packed_git(void); > extern void install_packed_git(struct packed_git *pack); > > +struct packed_git *get_packed_git(struct repository *r); > +struct list_head *get_packed_git_mru(struct repository *r); > + > /* > * Give a rough count of objects in the repository. This sacrifices accuracy > * for speed. > diff --git a/server-info.c b/server-info.c > index 26a6c20b7d..6fe64ede17 100644 > --- a/server-info.c > +++ b/server-info.c > @@ -1,4 +1,5 @@ > #include "cache.h" > +#include "repository.h" > #include "refs.h" > #include "object.h" > #include "commit.h" > @@ -200,7 +201,7 @@ static void init_pack_info(const char *infofile, int > force) > objdirlen = strlen(objdir); > > prepare_packed_git(); > - for (p = packed_git; p; p = p->next) { > + for (p = get_packed_git(the_repository); p; p = p->next) { > /* we ignore things on alternate path since they are >* not available to the pullers in general. >*/ > @@ -210,7 +211,7 @@ static void init_pack_info(const char *infofile, int > force) > } > num_pack = i; > info = xcalloc(num_pack, sizeof(struct pack_info *)); > - for (i = 0, p = packed_git; p; p = p->next) { > + for (i = 0, p = get_packed_git(the_repository); p; p = p->next) { > if (!p->pack_local) > continue; > info[i] = xcalloc(1, sizeof(struct pack_info)); > diff --git a/sha1_name.c b/sha1_name.c > index 957ce25680..bd4d7352ce 100644 > --- a/sha1_name.c > +++ b/sha1_name.c > @@ -196,7 +196,8 @@ static void find_short_packed_object(struct > disambiguate_state *ds) > struct packed_git *p; > > prepare_packed_git(); > - for (p = packed_git; p && !ds->ambiguous; p = p->next) > + for (p = get_packed_git(the_repository); p && !ds->ambiguous; > + p = p->next) > unique_in_pack(p, ds); > } > > @@ -566,7 +567,7 @@ static void find_abbrev_len_packed(struct min_abbrev_data > *mad) > struct packed_git *p; > > prepare_packed_git(); > - for (p = packed_git; p; p = p->next) > + for (p = get_packed_git(the_repository); p; p = p->next) > find_abbrev_len_for_pack(p, mad); > } > > -- > 2.16.1.435.g8f24da2e1a > -- Brandon Williams

Re: [PATCH 09/44] object-store: free alt_odb_list

2018-03-21 Thread Brandon Williams
L(o->alternate_db); > > + > > + free_alt_odbs(o); > > + o->alt_odb_tail = NULL; > > } > > The commit message talks about freeing memory and resetting > alt_odb_list and alt_odb_tail, but this code only resets alt_odb_tail. -- Brandon Williams

Re: [PATCH 06/44] repository: introduce raw object store field

2018-03-21 Thread Brandon Williams
struct config_set; > struct index_state; > struct submodule_cache; > @@ -21,13 +23,9 @@ struct repository { > char *commondir; > > /* > - * Path to the repository's object store. > - * Cannot be NULL after initialization. > + * Holds any information related to accessing the raw object content. >*/ > - char *objectdir; > - > - /* Path to extra alternate object database if not NULL */ > - char *alternate_db; > + struct raw_object_store objects; > > /* >* Path to the repository's graft file. > diff --git a/sha1_file.c b/sha1_file.c > index 4af422e3cf..792bb21c15 100644 > --- a/sha1_file.c > +++ b/sha1_file.c > @@ -671,7 +671,8 @@ void prepare_alt_odb(void) > return; > > alt_odb_tail = _odb_list; > - link_alt_odb_entries(the_repository->alternate_db, PATH_SEP, NULL, 0); > + link_alt_odb_entries(the_repository->objects.alternate_db, > + PATH_SEP, NULL, 0); > > read_info_alternates(get_object_directory(), 0); > } > -- > 2.16.1.435.g8f24da2e1a > -- Brandon Williams

Re: [PATCH 05/44] repository: delete ignore_env member

2018-03-21 Thread Brandon Williams
hich doesn't go through > - * the normal 'repo_init()' process. > - */ > - unsigned ignore_env:1; > > /* Indicate if a repository has a different 'commondir' from 'gitdir' */ > unsigned different_commondir:1; > -- > 2.16.1.435.g8f24da2e1a > -- Brandon Williams

Re: [PATCH 04/44] sha1_file.c: move delayed getenv(altdb) back to setup_git_env()

2018-03-21 Thread Brandon Williams
lt_odb(void) > { > - const char *alt; > - > if (alt_odb_tail) > return; > > - alt = getenv(ALTERNATE_DB_ENVIRONMENT); > - > alt_odb_tail = _odb_list; > - link_alt_odb_entries(alt, PATH_SEP, NULL, 0); > + link_alt_odb_entries(the_repository->alternate_db, PATH_SEP, NULL, 0); > > read_info_alternates(get_object_directory(), 0); > } > -- > 2.16.1.435.g8f24da2e1a > -- Brandon Williams

Re: [PATCH 03/44] repository.c: delete dead functions

2018-03-21 Thread Brandon Williams
har *def_in) > { > -- > 2.16.1.435.g8f24da2e1a > This patch needs to be squashed into the previous one, the build breaks otherwise (unless built with -Werror=unused-function). -- Brandon Williams

Re: [PATCH 02/44] repository.c: move env-related setup code back to environment.c

2018-03-21 Thread Brandon Williams
t. I'm still (very slowly) in > the process of unifying the repo setup for the main repo and > submodules, which hopefully may kill this function or replace it with > something better. But it's too early to tell. Since this part of the > series has landed in 'next', I'll post a fixup patch soon with your > suggestion. > -- > Duy Yeah looking at the patch this is probably my only complaint. The rest looked good. -- Brandon Williams

Re: [PATCH 01/44] repository: initialize the_repository in main()

2018-03-21 Thread Brandon Williams
ir, const char > *worktree); I had to double check that this was ok, it indeed is as repo_init is only used in repository.c. > +extern void initialize_the_repository(void); > extern int repo_submodule_init(struct repository *submodule, > struct repository *superproject, > const char *path); > -- > 2.16.1.435.g8f24da2e1a > -- Brandon Williams

[PATCH v6 04/35] upload-pack: convert to a builtin

2018-03-15 Thread Brandon Williams
In order to allow for code sharing with the server-side of fetch in protocol-v2 convert upload-pack to be a builtin. Signed-off-by: Brandon Williams <bmw...@google.com> --- Makefile | 3 +- builtin.h | 1 + builtin/upload-pack.c

[PATCH v6 05/35] upload-pack: factor out processing lines

2018-03-15 Thread Brandon Williams
Factor out the logic for processing shallow, deepen, deepen_since, and deepen_not lines into their own functions to simplify the 'receive_needs()' function in addition to making it easier to reuse some of this logic when implementing protocol_v2. Signed-off-by: Brandon Williams <bmw...@google.

[PATCH v6 14/35] connect: request remote refs using v2

2018-03-15 Thread Brandon Williams
Teach the client to be able to request a remote's refs using protocol v2. This is done by having a client issue a 'ls-refs' request to a v2 server. Signed-off-by: Brandon Williams <bmw...@google.com> --- builtin/upload-pack.c | 10 +-- connect.c

[PATCH v6 15/35] transport: convert get_refs_list to take a list of ref prefixes

2018-03-15 Thread Brandon Williams
on the sent prefixes. This list will be ignored when not using protocol v2. Signed-off-by: Brandon Williams <bmw...@google.com> --- transport-helper.c | 5 +++-- transport-internal.h | 11 ++- transport.c | 18 +++--- 3 files changed, 24 insertions(+), 10 del

[PATCH v6 25/35] transport-helper: remove name parameter

2018-03-15 Thread Brandon Williams
necessary but wasn't removed. Clean up 'recvline_fh()' parameter list by removing the 'name' parameter. Signed-off-by: Brandon Williams <bmw...@google.com> --- transport-helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/transport-helper.c b/transport-helper.c

[PATCH v6 21/35] fetch-pack: perform a fetch using v2

2018-03-15 Thread Brandon Williams
When communicating with a v2 server, perform a fetch by requesting the 'fetch' command. Signed-off-by: Brandon Williams <bmw...@google.com> --- Documentation/technical/protocol-v2.txt | 67 +- builtin/fetch-pack.c| 2 +- fetch-pack.c

[PATCH v6 23/35] connect: refactor git_connect to only get the protocol version once

2018-03-15 Thread Brandon Williams
in the next patch where we can have centralized logic which determines if we need to request a different protocol version than what the user has configured. Signed-off-by: Brandon Williams <bmw...@google.com> --- connect.c | 27 +++ 1 file changed, 15 insertions(+), 12 del

[PATCH v6 24/35] connect: don't request v2 when pushing

2018-03-15 Thread Brandon Williams
' endpoint and fall back to using v0, but when push v2 is rolled out to servers, the 'receive-pack' endpoint will start responding using v2. So we don't want to get into a state where a client is requesting to push with v2 before they actually know how to push using v2. Signed-off-by: Brandon

[PATCH v6 32/35] http: don't always add Git-Protocol header

2018-03-15 Thread Brandon Williams
Instead of always sending the Git-Protocol header with the configured version with every http request, explicitly send it when discovering refs and then only send it on subsequent http requests if the server understood the version requested. Signed-off-by: Brandon Williams <bmw...@google.

[PATCH v6 28/35] pkt-line: add packet_buf_write_len function

2018-03-15 Thread Brandon Williams
Add the 'packet_buf_write_len()' function which allows for writing an arbitrary length buffer into a 'struct strbuf' and formatting it in packet-line format. Signed-off-by: Brandon Williams <bmw...@google.com> --- pkt-line.c | 16 pkt-line.h | 1 + 2 files chang

[PATCH v6 31/35] http: allow providing extra headers for http requests

2018-03-15 Thread Brandon Williams
Add a way for callers to request that extra headers be included when making http requests. Signed-off-by: Brandon Williams <bmw...@google.com> --- http.c | 8 http.h | 7 +++ 2 files changed, 15 insertions(+) diff --git a/http.c b/http.c index 5977712712..e1757d62b2

[PATCH v6 33/35] http: eliminate "# service" line when using protocol v2

2018-03-15 Thread Brandon Williams
When an http info/refs request is made, requesting that protocol v2 be used, don't send a "# service" line since this line is not part of the v2 spec. Signed-off-by: Brandon Williams <bmw...@google.com> --- http-backend.c | 8 ++-- remote-curl.c | 3 +++ 2 files changed, 9

[PATCH v6 34/35] remote-curl: implement stateless-connect command

2018-03-15 Thread Brandon Williams
through to convert requests to http. Signed-off-by: Brandon Williams <bmw...@google.com> --- remote-curl.c | 207 - t/t5702-protocol-v2.sh | 45 + 2 files changed, 251 insertions(+), 1 deletion(-) diff --git a/remote-curl.c b/remote-

[PATCH v6 35/35] remote-curl: don't request v2 when pushing

2018-03-15 Thread Brandon Williams
' endpoint and fall back to using v0, but when push v2 is rolled out to servers, the 'receive-pack' endpoint will start responding using v2. So we don't want to get into a state where a client is requesting to push with v2 before they actually know how to push using v2. Signed-off-by: Brandon

[PATCH v6 27/35] transport-helper: introduce stateless-connect

2018-03-15 Thread Brandon Williams
) so that protocol v2 can be used using the http transport. Signed-off-by: Brandon Williams <bmw...@google.com> --- Documentation/gitremote-helpers.txt | 32 + transport-helper.c | 11 ++ transport.c | 1 + trans

[PATCH v6 26/35] transport-helper: refactor process_connect_service

2018-03-15 Thread Brandon Williams
A future patch will need to take advantage of the logic which runs and processes the response of the connect command on a remote helper so factor out this logic from 'process_connect_service()' and place it into a helper function 'run_connect()'. Signed-off-by: Brandon Williams <bmw...@google.

[PATCH v6 29/35] remote-curl: create copy of the service name

2018-03-15 Thread Brandon Williams
Make a copy of the service name being requested instead of relying on the buffer pointed to by the passed in 'const char *' to remain unchanged. Currently, all service names are string constants, but a subsequent patch will introduce service names from external sources. Signed-off-by: Brandon

[PATCH v6 30/35] remote-curl: store the protocol version the server responded with

2018-03-15 Thread Brandon Williams
Store the protocol version the server responded with when performing discovery. This will be used in a future patch to either change the 'Git-Protocol' header sent in subsequent requests or to determine if a client needs to fallback to using a different protocol version. Signed-off-by: Brandon

[PATCH v6 19/35] push: pass ref prefixes when pushing

2018-03-15 Thread Brandon Williams
Construct a list of ref prefixes to be passed to 'get_refs_list()' from the refspec to be used during the push. This list of ref prefixes will be used to allow the server to filter the ref advertisement when communicating using protocol v2. Signed-off-by: Brandon Williams <bmw...@google.

[PATCH v6 17/35] ls-remote: pass ref prefixes when requesting a remote's refs

2018-03-15 Thread Brandon Williams
Construct an argv_array of ref prefixes based on the patterns supplied via the command line and pass them to 'transport_get_remote_refs()' to be used when communicating protocol v2 so that the server can limit the ref advertisement based on those prefixes. Signed-off-by: Brandon Williams <

[PATCH v6 20/35] upload-pack: introduce fetch server command

2018-03-15 Thread Brandon Williams
Introduce the 'fetch' server command. Signed-off-by: Brandon Williams <bmw...@google.com> --- Documentation/technical/protocol-v2.txt | 125 +++ serve.c | 2 + t/t5701-git-serve.sh| 1 + upload-pack.c

[PATCH v6 12/35] serve: introduce git-serve

2018-03-15 Thread Brandon Williams
. At the completion of a command, a client can request that another command be executed or can terminate the connection by sending a flush packet. Signed-off-by: Brandon Williams <bmw...@google.com> --- .gitignore | 1 + Documentation/Makefile

[PATCH v6 18/35] fetch: pass ref prefixes when fetching

2018-03-15 Thread Brandon Williams
Construct a list of ref prefixes to be passed to 'transport_get_remote_refs()' from the refspec to be used during the fetch. This list of ref prefixes will be used to allow the server to filter the ref advertisement when communicating using protocol v2. Signed-off-by: Brandon Williams <

[PATCH v6 13/35] ls-refs: introduce ls-refs server command

2018-03-15 Thread Brandon Williams
based on provided ref-prefixes. Signed-off-by: Brandon Williams <bmw...@google.com> --- Documentation/technical/protocol-v2.txt | 31 +++ Makefile| 1 + ls-refs.c | 96 ls-

[PATCH v6 16/35] transport: convert transport_get_remote_refs to take a list of ref prefixes

2018-03-15 Thread Brandon Williams
Teach transport_get_remote_refs() to accept a list of ref prefixes, which will be sent to the server for use in filtering when using protocol v2. (This list will be ignored when not using protocol v2.) Signed-off-by: Brandon Williams <bmw...@google.com> --- builtin/clone.c | 2 +- b

[PATCH v6 22/35] fetch-pack: support shallow requests

2018-03-15 Thread Brandon Williams
Enable shallow clones and deepen requests using protocol version 2 if the server 'fetch' command supports the 'shallow' feature. Signed-off-by: Brandon Williams <bmw...@google.com> --- Documentation/technical/protocol-v2.txt | 18 --- connect.c

[PATCH v6 11/35] test-pkt-line: introduce a packet-line test helper

2018-03-15 Thread Brandon Williams
Introduce a packet-line test helper which can either pack or unpack an input stream into packet-lines and writes out the result to stdout. Signed-off-by: Brandon Williams <bmw...@google.com> --- Makefile | 1 + t/helper/test-pkt-line.

[PATCH v6 10/35] protocol: introduce enum protocol_version value protocol_v2

2018-03-15 Thread Brandon Williams
Introduce protocol_v2, a new value for 'enum protocol_version'. Subsequent patches will fill in the implementation of protocol_v2. Signed-off-by: Brandon Williams <bmw...@google.com> --- builtin/fetch-pack.c | 2 ++ builtin/receive-pack.c | 6 ++ builtin/send-pack.c| 3 +++ b

[PATCH v6 09/35] transport: store protocol version

2018-03-15 Thread Brandon Williams
-by: Brandon Williams <bmw...@google.com> --- transport.c | 35 ++- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/transport.c b/transport.c index 63c3dbab94..2378dcb38c 100644 --- a/transport.c +++ b/transport.c @@ -118,6 +118,7 @@

[PATCH v6 08/35] connect: discover protocol version outside of get_remote_heads

2018-03-15 Thread Brandon Williams
-by: Brandon Williams <bmw...@google.com> --- builtin/fetch-pack.c | 16 +++- builtin/send-pack.c | 17 +++-- connect.c| 27 ++- connect.h| 3 +++ remote-curl.c| 20 ++-- remote.h

[PATCH v6 03/35] pkt-line: add delim packet support

2018-03-15 Thread Brandon Williams
to indicate the end of a response. Documentation for how this packet will be used in protocol v2 will included in a future patch. Signed-off-by: Brandon Williams <bmw...@google.com> --- pkt-line.c | 16 pkt-line.h | 3 +++ 2 files changed, 19 insertions(+) diff --git a/pkt-li

[PATCH v6 07/35] connect: convert get_remote_heads to use struct packet_reader

2018-03-15 Thread Brandon Williams
the first ref sent in the protocol_v0 case so that the protocol version the server is speaking can be determined outside of 'get_remote_heads()' in a future patch. Signed-off-by: Brandon Williams <bmw...@google.com> --- connect.c | 173 ++

[PATCH v6 02/35] pkt-line: allow peeking a packet line without consuming it

2018-03-15 Thread Brandon Williams
a caller to be able to peek a single line at a time using 'packet_reader_peek()' and having a caller consume a line by calling 'packet_reader_read()'. Signed-off-by: Brandon Williams <bmw...@google.com> --- pkt-line.c | 50 ++ pkt-line.

[PATCH v6 06/35] transport: use get_refs_via_connect to get refs

2018-03-15 Thread Brandon Williams
Remove code duplication and use the existing 'get_refs_via_connect()' function to retrieve a remote's heads in 'fetch_refs_via_pack()' and 'git_transport_push()'. Signed-off-by: Brandon Williams <bmw...@google.com> --- transport.c | 18 -- 1 file changed, 4 insertions(

[PATCH v6 01/35] pkt-line: introduce packet_read_with_status

2018-03-15 Thread Brandon Williams
between special and normal packets as well as errors. It also enables easily adding a new special packet in the future. Signed-off-by: Brandon Williams <bmw...@google.com> --- pkt-line.c | 51 +-- pkt-line.h | 16 2 files chang

[PATCH v6 00/35] protocol version 2

2018-03-15 Thread Brandon Williams
Fixed the protocol-v2.txt technical document so that it builds when running "make doc". Brandon Williams (35): pkt-line: introduce packet_read_with_status pkt-line: allow peeking a packet line without consuming it pkt-line: add delim packet support upload-pack: convert to

Re: [PATCH v5 01/35] pkt-line: introduce packet_read_with_status

2018-03-15 Thread Brandon Williams
On 03/14, Junio C Hamano wrote: > Brandon Williams <bmw...@google.com> writes: > > > +/* > > + * Read a packetized line into a buffer like the 'packet_read()' function > > but > > + * returns an 'enum packet_read_status' which indicates the status of the &

Re: [PATCH v5 12/35] serve: introduce git-serve

2018-03-15 Thread Brandon Williams
On 03/14, Junio C Hamano wrote: > Brandon Williams <bmw...@google.com> writes: > > > Introduce git-serve, the base server for protocol version 2. > > ... > > Documentation/Makefile | 1 + > > Documentation/technical/protocol-v2.txt | 174 ++

[PATCH v5 06/35] transport: use get_refs_via_connect to get refs

2018-03-14 Thread Brandon Williams
Remove code duplication and use the existing 'get_refs_via_connect()' function to retrieve a remote's heads in 'fetch_refs_via_pack()' and 'git_transport_push()'. Signed-off-by: Brandon Williams <bmw...@google.com> --- transport.c | 18 -- 1 file changed, 4 insertions(

[PATCH v5 05/35] upload-pack: factor out processing lines

2018-03-14 Thread Brandon Williams
Factor out the logic for processing shallow, deepen, deepen_since, and deepen_not lines into their own functions to simplify the 'receive_needs()' function in addition to making it easier to reuse some of this logic when implementing protocol_v2. Signed-off-by: Brandon Williams <bmw...@google.

[PATCH v5 08/35] connect: discover protocol version outside of get_remote_heads

2018-03-14 Thread Brandon Williams
-by: Brandon Williams <bmw...@google.com> --- builtin/fetch-pack.c | 16 +++- builtin/send-pack.c | 17 +++-- connect.c| 27 ++- connect.h| 3 +++ remote-curl.c| 20 ++-- remote.h

[PATCH v5 09/35] transport: store protocol version

2018-03-14 Thread Brandon Williams
-by: Brandon Williams <bmw...@google.com> --- transport.c | 35 ++- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/transport.c b/transport.c index 63c3dbab94..2378dcb38c 100644 --- a/transport.c +++ b/transport.c @@ -118,6 +118,7 @@

[PATCH v5 16/35] transport: convert transport_get_remote_refs to take a list of ref prefixes

2018-03-14 Thread Brandon Williams
Teach transport_get_remote_refs() to accept a list of ref prefixes, which will be sent to the server for use in filtering when using protocol v2. (This list will be ignored when not using protocol v2.) Signed-off-by: Brandon Williams <bmw...@google.com> --- builtin/clone.c | 2 +- b

[PATCH v5 15/35] transport: convert get_refs_list to take a list of ref prefixes

2018-03-14 Thread Brandon Williams
on the sent prefixes. This list will be ignored when not using protocol v2. Signed-off-by: Brandon Williams <bmw...@google.com> --- transport-helper.c | 5 +++-- transport-internal.h | 11 ++- transport.c | 18 +++--- 3 files changed, 24 insertions(+), 10 del

[PATCH v5 24/35] connect: don't request v2 when pushing

2018-03-14 Thread Brandon Williams
' endpoint and fall back to using v0, but when push v2 is rolled out to servers, the 'receive-pack' endpoint will start responding using v2. So we don't want to get into a state where a client is requesting to push with v2 before they actually know how to push using v2. Signed-off-by: Brandon

[PATCH v5 20/35] upload-pack: introduce fetch server command

2018-03-14 Thread Brandon Williams
Introduce the 'fetch' server command. Signed-off-by: Brandon Williams <bmw...@google.com> --- Documentation/technical/protocol-v2.txt | 127 +++ serve.c | 2 + t/t5701-git-serve.sh| 1 + upload-pack.c

[PATCH v5 30/35] remote-curl: store the protocol version the server responded with

2018-03-14 Thread Brandon Williams
Store the protocol version the server responded with when performing discovery. This will be used in a future patch to either change the 'Git-Protocol' header sent in subsequent requests or to determine if a client needs to fallback to using a different protocol version. Signed-off-by: Brandon

[PATCH v5 25/35] transport-helper: remove name parameter

2018-03-14 Thread Brandon Williams
necessary but wasn't removed. Clean up 'recvline_fh()' parameter list by removing the 'name' parameter. Signed-off-by: Brandon Williams <bmw...@google.com> --- transport-helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/transport-helper.c b/transport-helper.c

[PATCH v5 23/35] connect: refactor git_connect to only get the protocol version once

2018-03-14 Thread Brandon Williams
in the next patch where we can have centralized logic which determines if we need to request a different protocol version than what the user has configured. Signed-off-by: Brandon Williams <bmw...@google.com> --- connect.c | 27 +++ 1 file changed, 15 insertions(+), 12 del

[PATCH v5 34/35] remote-curl: implement stateless-connect command

2018-03-14 Thread Brandon Williams
through to convert requests to http. Signed-off-by: Brandon Williams <bmw...@google.com> --- remote-curl.c | 207 - t/t5702-protocol-v2.sh | 45 + 2 files changed, 251 insertions(+), 1 deletion(-) diff --git a/remote-curl.c b/remote-

[PATCH v5 35/35] remote-curl: don't request v2 when pushing

2018-03-14 Thread Brandon Williams
' endpoint and fall back to using v0, but when push v2 is rolled out to servers, the 'receive-pack' endpoint will start responding using v2. So we don't want to get into a state where a client is requesting to push with v2 before they actually know how to push using v2. Signed-off-by: Brandon

[PATCH v5 33/35] http: eliminate "# service" line when using protocol v2

2018-03-14 Thread Brandon Williams
When an http info/refs request is made, requesting that protocol v2 be used, don't send a "# service" line since this line is not part of the v2 spec. Signed-off-by: Brandon Williams <bmw...@google.com> --- http-backend.c | 8 ++-- remote-curl.c | 3 +++ 2 files changed, 9

[PATCH v5 32/35] http: don't always add Git-Protocol header

2018-03-14 Thread Brandon Williams
Instead of always sending the Git-Protocol header with the configured version with every http request, explicitly send it when discovering refs and then only send it on subsequent http requests if the server understood the version requested. Signed-off-by: Brandon Williams <bmw...@google.

[PATCH v5 29/35] remote-curl: create copy of the service name

2018-03-14 Thread Brandon Williams
Make a copy of the service name being requested instead of relying on the buffer pointed to by the passed in 'const char *' to remain unchanged. Currently, all service names are string constants, but a subsequent patch will introduce service names from external sources. Signed-off-by: Brandon

[PATCH v5 28/35] pkt-line: add packet_buf_write_len function

2018-03-14 Thread Brandon Williams
Add the 'packet_buf_write_len()' function which allows for writing an arbitrary length buffer into a 'struct strbuf' and formatting it in packet-line format. Signed-off-by: Brandon Williams <bmw...@google.com> --- pkt-line.c | 16 pkt-line.h | 1 + 2 files chang

[PATCH v5 31/35] http: allow providing extra headers for http requests

2018-03-14 Thread Brandon Williams
Add a way for callers to request that extra headers be included when making http requests. Signed-off-by: Brandon Williams <bmw...@google.com> --- http.c | 8 http.h | 7 +++ 2 files changed, 15 insertions(+) diff --git a/http.c b/http.c index 5977712712..e1757d62b2

[PATCH v5 27/35] transport-helper: introduce stateless-connect

2018-03-14 Thread Brandon Williams
) so that protocol v2 can be used using the http transport. Signed-off-by: Brandon Williams <bmw...@google.com> --- Documentation/gitremote-helpers.txt | 32 + transport-helper.c | 11 ++ transport.c | 1 + trans

[PATCH v5 21/35] fetch-pack: perform a fetch using v2

2018-03-14 Thread Brandon Williams
When communicating with a v2 server, perform a fetch by requesting the 'fetch' command. Signed-off-by: Brandon Williams <bmw...@google.com> --- Documentation/technical/protocol-v2.txt | 68 +- builtin/fetch-pack.c| 2 +- fetch-pack.c

[PATCH v5 26/35] transport-helper: refactor process_connect_service

2018-03-14 Thread Brandon Williams
A future patch will need to take advantage of the logic which runs and processes the response of the connect command on a remote helper so factor out this logic from 'process_connect_service()' and place it into a helper function 'run_connect()'. Signed-off-by: Brandon Williams <bmw...@google.

[PATCH v5 22/35] fetch-pack: support shallow requests

2018-03-14 Thread Brandon Williams
Enable shallow clones and deepen requests using protocol version 2 if the server 'fetch' command supports the 'shallow' feature. Signed-off-by: Brandon Williams <bmw...@google.com> --- connect.c| 22 connect.h| 2 ++ fetch-pack.

[PATCH v5 19/35] push: pass ref prefixes when pushing

2018-03-14 Thread Brandon Williams
Construct a list of ref prefixes to be passed to 'get_refs_list()' from the refspec to be used during the push. This list of ref prefixes will be used to allow the server to filter the ref advertisement when communicating using protocol v2. Signed-off-by: Brandon Williams <bmw...@google.

[PATCH v5 17/35] ls-remote: pass ref prefixes when requesting a remote's refs

2018-03-14 Thread Brandon Williams
Construct an argv_array of ref prefixes based on the patterns supplied via the command line and pass them to 'transport_get_remote_refs()' to be used when communicating protocol v2 so that the server can limit the ref advertisement based on those prefixes. Signed-off-by: Brandon Williams <

[PATCH v5 13/35] ls-refs: introduce ls-refs server command

2018-03-14 Thread Brandon Williams
based on provided ref-prefixes. Signed-off-by: Brandon Williams <bmw...@google.com> --- Documentation/technical/protocol-v2.txt | 31 +++ Makefile| 1 + ls-refs.c | 96 ls-

[PATCH v5 18/35] fetch: pass ref prefixes when fetching

2018-03-14 Thread Brandon Williams
Construct a list of ref prefixes to be passed to 'transport_get_remote_refs()' from the refspec to be used during the fetch. This list of ref prefixes will be used to allow the server to filter the ref advertisement when communicating using protocol v2. Signed-off-by: Brandon Williams <

[PATCH v5 12/35] serve: introduce git-serve

2018-03-14 Thread Brandon Williams
. At the completion of a command, a client can request that another command be executed or can terminate the connection by sending a flush packet. Signed-off-by: Brandon Williams <bmw...@google.com> --- .gitignore | 1 + Documentation/Makefile

[PATCH v5 14/35] connect: request remote refs using v2

2018-03-14 Thread Brandon Williams
Teach the client to be able to request a remote's refs using protocol v2. This is done by having a client issue a 'ls-refs' request to a v2 server. Signed-off-by: Brandon Williams <bmw...@google.com> --- builtin/upload-pack.c | 10 +-- connect.c

[PATCH v5 11/35] test-pkt-line: introduce a packet-line test helper

2018-03-14 Thread Brandon Williams
Introduce a packet-line test helper which can either pack or unpack an input stream into packet-lines and writes out the result to stdout. Signed-off-by: Brandon Williams <bmw...@google.com> --- Makefile | 1 + t/helper/test-pkt-line.

[PATCH v5 10/35] protocol: introduce enum protocol_version value protocol_v2

2018-03-14 Thread Brandon Williams
Introduce protocol_v2, a new value for 'enum protocol_version'. Subsequent patches will fill in the implementation of protocol_v2. Signed-off-by: Brandon Williams <bmw...@google.com> --- builtin/fetch-pack.c | 2 ++ builtin/receive-pack.c | 6 ++ builtin/send-pack.c| 3 +++ b

[PATCH v5 04/35] upload-pack: convert to a builtin

2018-03-14 Thread Brandon Williams
In order to allow for code sharing with the server-side of fetch in protocol-v2 convert upload-pack to be a builtin. Signed-off-by: Brandon Williams <bmw...@google.com> --- Makefile | 3 +- builtin.h | 1 + builtin/upload-pack.c

[PATCH v5 07/35] connect: convert get_remote_heads to use struct packet_reader

2018-03-14 Thread Brandon Williams
the first ref sent in the protocol_v0 case so that the protocol version the server is speaking can be determined outside of 'get_remote_heads()' in a future patch. Signed-off-by: Brandon Williams <bmw...@google.com> --- connect.c | 173 ++

[PATCH v5 02/35] pkt-line: allow peeking a packet line without consuming it

2018-03-14 Thread Brandon Williams
a caller to be able to peek a single line at a time using 'packet_reader_peek()' and having a caller consume a line by calling 'packet_reader_read()'. Signed-off-by: Brandon Williams <bmw...@google.com> --- pkt-line.c | 50 ++ pkt-line.

[PATCH v5 01/35] pkt-line: introduce packet_read_with_status

2018-03-14 Thread Brandon Williams
between special and normal packets as well as errors. It also enables easily adding a new special packet in the future. Signed-off-by: Brandon Williams <bmw...@google.com> --- pkt-line.c | 51 +-- pkt-line.h | 16 2 files chang

[PATCH v5 03/35] pkt-line: add delim packet support

2018-03-14 Thread Brandon Williams
to indicate the end of a response. Documentation for how this packet will be used in protocol v2 will included in a future patch. Signed-off-by: Brandon Williams <bmw...@google.com> --- pkt-line.c | 16 pkt-line.h | 3 +++ 2 files changed, 19 insertions(+) diff --git a/pkt-li

[PATCH v5 00/35] protocol version 2

2018-03-14 Thread Brandon Williams
...@google.com/ Brandon Williams (35): pkt-line: introduce packet_read_with_status pkt-line: allow peeking a packet line without consuming it pkt-line: add delim packet support upload-pack: convert to a builtin upload-pack: factor out processing lines transport: use get_refs_via_connect

Re: [PATCH v4 27/35] transport-helper: introduce stateless-connect

2018-03-14 Thread Brandon Williams
On 03/13, Jonathan Tan wrote: > On Wed, 28 Feb 2018 15:22:44 -0800 > Brandon Williams <bmw...@google.com> wrote: > > > +'stateless-connect':: > > + Experimental; for internal use only. > > + Can attempt to connect to a remote server for communication > >

Re: [PATCH v4 20/35] upload-pack: introduce fetch server command

2018-03-13 Thread Brandon Williams
On 03/13, Jonathan Tan wrote: > On Wed, 28 Feb 2018 15:22:37 -0800 > Brandon Williams <bmw...@google.com> wrote: > > > +output = *section > > +section = (acknowledgments | packfile) > > + (flush-pkt | delim-pkt) > > + > > +ac

Re: [PATCH v4 12/35] serve: introduce git-serve

2018-03-13 Thread Brandon Williams
On 03/02, Junio C Hamano wrote: > Brandon Williams <bmw...@google.com> writes: > > > + Capabilities > > +~~ > > + > > +There are two different types of capabilities: normal capabilities, > > +which can be used to to convey informati

Re: [PATCH v4 12/35] serve: introduce git-serve

2018-03-13 Thread Brandon Williams
On 03/02, Junio C Hamano wrote: > Brandon Williams <bmw...@google.com> writes: > > +static int is_command(const char *key, struct protocol_capability > > **command) > > +{ > > + const char *out; > > + > > + if (skip_prefix(key, "command="

Re: [PATCH v4 13/35] ls-refs: introduce ls-refs server command

2018-03-13 Thread Brandon Williams
On 03/02, Junio C Hamano wrote: > Brandon Williams <bmw...@google.com> writes: > > > + ls-refs > > +- > > + > > +`ls-refs` is the command used to request a reference advertisement in v2. > > +Unlike the current reference advertisement, ls-refs

Re: [PATCH v4 13/35] ls-refs: introduce ls-refs server command

2018-03-13 Thread Brandon Williams
On 03/05, Jeff King wrote: > On Mon, Mar 05, 2018 at 10:21:55AM -0800, Brandon Williams wrote: > > > > Hmm, so this would accept stuff like "refs/heads/*/foo" but quietly > > > ignore the "/foo" part. > > > > Yeah that's true...this s

Re: [PATCH v4 01/35] pkt-line: introduce packet_read_with_status

2018-03-13 Thread Brandon Williams
On 03/13, Jonathan Tan wrote: > On Wed, 28 Feb 2018 15:22:18 -0800 > Brandon Williams <bmw...@google.com> wrote: > > > + if (len < 0) { > > die("protocol error: bad line length character: %.4s", linelen); > > - if (!len) { > >

Re: [PATCH v4 04/35] upload-pack: convert to a builtin

2018-03-13 Thread Brandon Williams
On 03/13, Jonathan Tan wrote: > On Wed, 28 Feb 2018 15:22:21 -0800 > Brandon Williams <bmw...@google.com> wrote: > > > In order to allow for code sharing with the server-side of fetch in > > protocol-v2 convert upload-pack to be a builtin. > > > &g

Re: Git Merge contributor summit notes

2018-03-12 Thread Brandon Williams
we should have _something_ that is easy to spin up. But it > would be wonderful if git-over-http could become that, and we could just > deprecate git://. I suppose it's possible people build clients without > curl, but I suspect that's an extreme minority these days (most third > party hosters don't seem to offer git:// at all). > > -Peff -- Brandon Williams

Re: [PATCH v4 05/35] upload-pack: factor out processing lines

2018-03-12 Thread Brandon Williams
On 03/12, Brandon Williams wrote: > On 03/01, Junio C Hamano wrote: > > Brandon Williams <bmw...@google.com> writes: > > > > > Factor out the logic for processing shallow, deepen, deepen_since, and > > > deepen_not lines into their own functions to simpli

Re: [PATCH v4 05/35] upload-pack: factor out processing lines

2018-03-12 Thread Brandon Williams
On 03/01, Junio C Hamano wrote: > Brandon Williams <bmw...@google.com> writes: > > > Factor out the logic for processing shallow, deepen, deepen_since, and > > deepen_not lines into their own functions to simplify the > > 'receive_needs()' function in addition to

Re: [PATCH v4 19/35] push: pass ref patterns when pushing

2018-03-12 Thread Brandon Williams
On 03/02, Junio C Hamano wrote: > Brandon Williams <bmw...@google.com> writes: > > > Construct a list of ref patterns to be passed to 'get_refs_list()' from > > the refspec to be used during the push. This list of ref patterns will > > be used to allow the server t

<    1   2   3   4   5   6   7   8   9   10   >