[PATCH v2] diff-tree: read the index so attribute checks work in bare repositories

2017-12-06 Thread Brandon Williams
ly reading the index during the setup of diff-tree. Reported-by: Ben Boeckel Signed-off-by: Brandon Williams --- builtin/diff-tree.c| 2 ++ t/t4015-diff-whitespace.sh | 17 + 2 files changed, 19 insertions(+) diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c index d66

Re: [WIP 06/15] transport: use get_refs_via_connect to get refs

2017-12-07 Thread Brandon Williams
On 12/06, Junio C Hamano wrote: > Brandon Williams writes: > > > 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_tran

Re: [WIP 08/15] connect: discover protocol version outside of get_remote_heads

2017-12-07 Thread Brandon Williams
On 12/07, Junio C Hamano wrote: > Brandon Williams writes: > > > @@ -193,7 +195,17 @@ int cmd_fetch_pack(int argc, const char **argv, const > > char *prefix) > > if (!conn) > > return args.diag_url ? 0 : 1; > > } > >

Re: [PATCH v6 03/12] fsck: support refs pointing to promisor objects

2017-12-07 Thread Brandon Williams
cleanup by adding in 'test_when_finished' lines to do the removals? Just a thought. > + test_create_repo repo && > + test_commit -C repo my_commit && > + > + A=$(git -C repo commit-tree -m a HEAD^{tree}) && > + > + # Reference $A only from ref > + git -C repo branch my_branch "$A" && > + promise_and_delete "$A" && > + > + git -C repo config core.repositoryformatversion 1 && > + git -C repo config extensions.partialclone "arbitrary string" && > + git -C repo fsck > +' > + > test_done > -- > 2.9.3 > -- Brandon Williams

Re: [PATCH v6 03/12] fsck: support refs pointing to promisor objects

2017-12-07 Thread Brandon Williams
On 12/07, Jonathan Tan wrote: > On Thu, 7 Dec 2017 11:18:52 -0800 > Brandon Williams wrote: > > > Instead of requiring that every test first removes 'repo', maybe you > > want to have each test do its own cleanup by adding in > > 'test_when_finished&

Re: [PATCH v6 09/12] fixup: sha1_file: convert gotos to break/continue

2017-12-07 Thread Brandon Williams
t */ > + if (fetch_if_missing && repository_format_partial_clone && > + !already_retried) { > + fetch_object(repository_format_partial_clone, real); > + already_retried = 1; > + continue; > + } > + > + return -1; > + } > > -found_packed: > if (oi == &blank_oi) > /* >* We know that the caller doesn't actually need the > -- > 2.9.3 > -- Brandon Williams

Re: [WIP 01/15] pkt-line: introduce packet_read_with_status

2017-12-08 Thread Brandon Williams
On 12/07, Stefan Beller wrote: > On Mon, Dec 4, 2017 at 3:58 PM, Brandon Williams wrote: > > > diff --git a/pkt-line.h b/pkt-line.h > > index 3dad583e2..f1545929b 100644 > > --- a/pkt-line.h > > +++ b/pkt-line.h > > @@ -60,8 +60,16 @@ int write_packetized

Re: [WIP 02/15] pkt-line: introduce struct packet_reader

2017-12-08 Thread Brandon Williams
On 12/07, Stefan Beller wrote: > On Mon, Dec 4, 2017 at 3:58 PM, Brandon Williams wrote: > > Sometimes it is advantageous to be able to peek the next packet line > > without consuming it (e.g. to be able to determine the protocol version > > a server is speaking). In order

Re: [WIP 03/15] pkt-line: add delim packet support

2017-12-08 Thread Brandon Williams
On 12/07, Stefan Beller wrote: > On Mon, Dec 4, 2017 at 3:58 PM, Brandon Williams wrote: > > One of the design goals of protocol-v2 is to improve the semantics of > > flush packets. Currently in protocol-v1, flush packets are used both to > > indicate a break in a list of pa

Re: [WIP 08/15] connect: discover protocol version outside of get_remote_heads

2017-12-08 Thread Brandon Williams
On 12/07, Junio C Hamano wrote: > Brandon Williams writes: > > > While we could wrap the preamble into a function it sort of defeats the > > purpose since you want to be able to call different functions based on > > the protocol version you're speaking

Re: [WIP 04/15] upload-pack: convert to a builtin

2017-12-08 Thread Brandon Williams
On 12/06, Junio C Hamano wrote: > Brandon Williams writes: > > > 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 > > --- > > This looks

Re: [WIP 07/15] connect: convert get_remote_heads to use struct packet_reader

2017-12-08 Thread Brandon Williams
On 12/06, Junio C Hamano wrote: > Brandon Williams writes: > > > EXPECTING_DONE sounded like we are expecting to see 'done' packet > sent from the other side, but I was mistaken. It is the state > where we are "done" expecting anything ;-). > > Ha

Re: [WIP 11/15] serve: introduce git-serve

2017-12-08 Thread Brandon Williams
On 12/07, Junio C Hamano wrote: > Brandon Williams writes: > > > +static struct protocol_capability *get_capability(const char *key) > > +{ > > + int i; > > + > > + if (!key) > > + return NULL; > > + > > + for (i = 0; i <

Re: [PATCH v7 00/16] Parial clone part 3: clone, fetch, fetch-pack, upload-pack, and tests

2017-12-08 Thread Brandon Williams
is a promised object before you go out to contact the server to request it? You may have already ruled this out for some reason I'm not aware of (maybe its too costly to compute?). -- Brandon Williams

Re: [PATCH 1/3] repository: fix repo_read_index with submodules

2017-12-11 Thread Brandon Williams
> + > int is_index_unborn(struct index_state *istate) > { > return (!istate->cache_nr && !istate->timestamp.sec); > diff --git a/repository.c b/repository.c > index bb2fae5446..928b1f553d 100644 > --- a/repository.c > +++ b/repository.c > @@ -229,5 +229,5 @@ int repo_read_index(struct repository *repo) > if (!repo->index) > repo->index = xcalloc(1, sizeof(*repo->index)); > > - return read_index_from(repo->index, repo->index_file); > + return read_index_for_repo(repo); > } > -- > 2.15.1.504.g5279b80103 > -- Brandon Williams

Re: [PATCH 2/3] prune: fix pruning with multiple worktrees and split index

2017-12-11 Thread Brandon Williams
continue; /* current index already taken care of */ > + if (repo_worktree_init(repo, wt)) > + BUG("couldn't initialize repository object from > worktree"); > > - if (read_index_from(&istate, > - worktree_git_path(wt, "index")) > 0) > - do_add_index_objects_to_pending(revs, &istate); > - discard_index(&istate); > + if (repo_read_index(repo) > 0) > + do_add_index_objects_to_pending(revs, repo->index); > + discard_index(repo->index); One we have separate object stores per-repository how would we handle this since this pruning should only work on a single repository's object store? > } > free_worktrees(worktrees); > } > -- > 2.15.1.504.g5279b80103 > -- Brandon Williams

Re: [PATCH] clone: support 'clone --shared' from a worktree

2017-12-11 Thread Brandon Williams
> > +test_expect_success 'local clone --shared from linked checkout' ' > + git -C bare worktree add --detach ../baretree && > + git clone --local --shared baretree bare-clone && > + grep /bare/ bare-clone/.git/objects/info/alternates > +' > + > test_expect_success '"add" worktree with --no-checkout' ' > git worktree add --no-checkout -b swamp swamp && > ! test -e swamp/init.t && > -- > 2.15.1.502.gccaef8de57 > -- Brandon Williams

Re: [PATCH] clone: support 'clone --shared' from a worktree

2017-12-11 Thread Brandon Williams
On 12/11, Eric Sunshine wrote: > On Mon, Dec 11, 2017 at 7:18 PM, Brandon Williams wrote: > > On 12/11, Eric Sunshine wrote: > >> struct strbuf alt = STRBUF_INIT; > >> - strbuf_addf(&alt, "%s/objects", src_repo); > &g

[PATCH 0/3] convert submodule.c to not use the index compat macros

2017-12-12 Thread Brandon Williams
This series removes the remaining users of the index compatibility macros and ensures that future uses of the macros will result in compiler errors. Brandon Williams (3): submodule: convert stage_updated_gitmodules to take a struct index_state submodule: used correct index in

[PATCH 2/3] submodule: used correct index in is_staging_gitmodules_ok

2017-12-12 Thread Brandon Williams
stead of the passed in 'struct index_state'. Fix this by changing the call to 'ie_match_stat()' and using the passed in index_state struct. Signed-off-by: Brandon Williams --- submodule.c | 5 +++-- submodule.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff

[PATCH 3/3] submodule: convert get_next_submodule to not rely on the_index

2017-12-12 Thread Brandon Williams
7;NO_THE_INDEX_COMPATIBILITY_MACROS' to prevent future users of these macros in submodule.c. Signed-off-by: Brandon Williams --- builtin/fetch.c | 4 +++- submodule.c | 23 +-- submodule.h | 10 ++ 3 files changed, 22 insertions(+), 15 deletions(-) diff -

[PATCH 1/3] submodule: convert stage_updated_gitmodules to take a struct index_state

2017-12-12 Thread Brandon Williams
Signed-off-by: Brandon Williams --- builtin/mv.c | 2 +- builtin/rm.c | 2 +- submodule.c | 4 ++-- submodule.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/builtin/mv.c b/builtin/mv.c index ffdd5f01a..cf3684d90 100644 --- a/builtin/mv.c +++ b/builtin/mv.c @@ -291,7

[PATCH] path: document path functions

2017-12-13 Thread Brandon Williams
Signed-off-by: Brandon Williams --- As promised here is an update to the documentation for the path generating functions. path.h | 133 ++--- 1 file changed, 112 insertions(+), 21 deletions(-) diff --git a/path.h b/path.h index

Re: [PATCH v2 1/3] repository: fix repo_read_index with submodules

2017-12-18 Thread Brandon Williams
nborn(struct index_state *istate) > { > return (!istate->cache_nr && !istate->timestamp.sec); > diff --git a/repository.c b/repository.c > index bb2fae5446..928b1f553d 100644 > --- a/repository.c > +++ b/repository.c > @@ -229,5 +229,5 @@ int repo_read_index(struct repository *repo) > if (!repo->index) > repo->index = xcalloc(1, sizeof(*repo->index)); > > - return read_index_from(repo->index, repo->index_file); > + return read_index_for_repo(repo); > } > -- > 2.15.1.620.gb9897f4670 > -- Brandon Williams

Re: [PATCH v2 2/3] prune: fix pruning with multiple worktrees and split index

2017-12-18 Thread Brandon Williams
1_hex); + base_path = xstrfmt("%s/sharedindex.%s", gitdir, base_sha1_hex); ret = do_read_index(split_index->base, base_path, 1); if (hashcmp(split_index->base_sha1, split_index->base->sha1)) die("broken index, expect %s in %s, got %s", base_sha1_hex, base_path, sha1_to_hex(split_index->base->sha1)); - freshen_shared_index(base_sha1_hex, 0); + freshen_shared_index(base_path, 0); merge_base_index(istate); post_read_index_from(istate); + free(base_path); return ret; -- Brandon Williams

Re: [PATCH v2 1/3] repository: fix repo_read_index with submodules

2017-12-18 Thread Brandon Williams
On 12/18, Thomas Gummerer wrote: > On 12/18, Brandon Williams wrote: > > On 12/17, Thomas Gummerer wrote: > > > repo_read_index calls read_index_from, which takes an path argument for > > > the location of the index file. For the split index however it relies > &

Re: [PATCH] oidmap.h: strongly discourage using OIDMAP_INIT directly

2017-12-22 Thread Brandon Williams
map incompletely here because oidset_insert() > + * will call oidset_init() (which will call oidmap_init()), and > + * oidset_contains() works as intended even before oidset_init() was called. > + */ > +#define OIDSET_INIT { OIDMAP_INIT_INCOMPLETELY } > > /** > * Returns true iff `set` contains `oid`. > > base-commit: 936d1b989416a95f593bf81ccae8ac62cd83f279 > -- > 2.15.1.windows.2 -- Brandon Williams

[PATCH] oidmap: ensure map is initialized

2017-12-22 Thread Brandon Williams
Ensure that an oidmap is initialized before attempting to add, remove, or retrieve an entry by simply performing the initialization step before accessing the underlying hashmap. Signed-off-by: Brandon Williams --- oidmap.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a

[PATCH 01/26] pkt-line: introduce packet_read_with_status

2018-01-02 Thread Brandon Williams
_status' type. This allows for easily identifying 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 --- pkt-line.c | 55 ++- pkt-line.h | 15

[PATCH 13/26] connect: request remote refs using v2

2018-01-02 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 --- connect.c | 101 - remote.h

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

2018-01-02 Thread Brandon Williams
ned-off-by: Brandon Williams --- builtin/fetch-pack.c | 16 +++- builtin/send-pack.c | 17 +++-- connect.c| 15 --- connect.h| 3 +++ remote-curl.c| 20 ++-- remote.h | 5 +++-- transport.c

[PATCH 02/26] pkt-line: introduce struct packet_reader

2018-01-02 Thread Brandon Williams
enables 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 --- pkt-line.c | 59 ++

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

2018-01-02 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 --- Makefile | 3 ++- builtin.h | 1 + git.c | 1 + upload-pack.c | 2 +- 4 files changed, 5 insertions(+), 2 deletions(-) diff

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

2018-01-02 Thread Brandon Williams
st line without consuming 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 --- connect.c | 127 +++

[PATCH 14/26] transport: convert get_refs_list to take a list of ref patterns

2018-01-02 Thread Brandon Williams
fs it sends based on the sent patterns. Signed-off-by: Brandon Williams --- transport-helper.c | 5 +++-- transport-internal.h | 4 +++- transport.c | 16 +--- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/transport-helper.c b/transport-helper.c index

[PATCH 16/26] ls-remote: pass ref patterns when requesting a remote's refs

2018-01-02 Thread Brandon Williams
Construct an argv_array of the ref 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 the supplied patterns. Signed-off-by: Brandon Williams ---

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

2018-01-02 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 -

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

2018-01-02 Thread Brandon Williams
eserved to indicate the end of a response. Signed-off-by: Brandon Williams --- pkt-line.c | 19 ++- pkt-line.h | 3 +++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/pkt-line.c b/pkt-line.c index 98c2d7d68..3159cbe10 100644 --- a/pkt-line.c +++ b/pkt-line.c @@ -9

[PATCH 18/26] push: pass ref patterns when pushing

2018-01-02 Thread Brandon Williams
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 to filter the ref advertisement when communicating using protocol v2. Signed-off-by: Brandon Williams --- transp

[PATCH 00/26] protocol version 2

2018-01-02 Thread Brandon Williams
dback is appreciated! Thanks! Brandon Brandon Williams (26): pkt-line: introduce packet_read_with_status pkt-line: introduce struct packet_reader pkt-line: add delim packet support upload-pack: convert to a builtin upload-pack: factor out processing lines transport: use get_refs_via

[PATCH 23/26] transport-helper: introduce connect-half-duplex

2018-01-02 Thread Brandon Williams
hat the client should fallback to using the dumb remote-helper commands. Signed-off-by: Brandon Williams --- transport-helper.c | 8 transport.c| 1 + transport.h| 6 ++ 3 files changed, 15 insertions(+) diff --git a/transport-helper.c b/transport-helper.c index c03

[PATCH 20/26] fetch-pack: perform a fetch using v2

2018-01-02 Thread Brandon Williams
When communicating with a v2 server, perform a fetch by requesting the 'fetch' command. Signed-off-by: Brandon Williams --- builtin/fetch-pack.c | 2 +- fetch-pack.c | 267 - fetch-pack.h | 4 +- t/t5701-prot

[PATCH 21/26] transport-helper: remove name parameter

2018-01-02 Thread Brandon Williams
was removed the parameter was no longer necessary but wasn't removed. Clean up 'recvline_fh()' parameter list by removing the 'name' parameter. Signed-off-by: Brandon Williams --- transport-helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/t

[PATCH 24/26] pkt-line: add packet_buf_write_len function

2018-01-02 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 --- pkt-line.c | 16 pkt-line.h | 1 + 2 files changed, 17 inserti

[PATCH 12/26] ls-refs: introduce ls-refs server command

2018-01-02 Thread Brandon Williams
based on provided ref-patterns. Signed-off-by: Brandon Williams --- Documentation/technical/protocol-v2.txt | 26 + Makefile| 1 + ls-refs.c | 97 + ls-refs.h | 9

[PATCH 26/26] remote-curl: implement connect-half-duplex command

2018-01-02 Thread Brandon Williams
as a pass through to convert requests to http. Signed-off-by: Brandon Williams --- remote-curl.c | 185 - t/t5701-protocol-v2.sh | 41 +++ 2 files changed, 224 insertions(+), 2 deletions(-) diff --git a/remote-curl.c b/remote-cu

[PATCH 19/26] upload-pack: introduce fetch server command

2018-01-02 Thread Brandon Williams
Introduce the 'fetch' server command. Signed-off-by: Brandon Williams --- Documentation/technical/protocol-v2.txt | 14 ++ serve.c | 2 + upload-pack.c | 290 upl

[PATCH 22/26] transport-helper: refactor process_connect_service

2018-01-02 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 Will

[PATCH 15/26] transport: convert transport_get_remote_refs to take a list of ref patterns

2018-01-02 Thread Brandon Williams
Convert 'transport_get_remote_refs()' to optionally take a list of ref patterns. Signed-off-by: Brandon Williams --- builtin/clone.c | 2 +- builtin/fetch.c | 4 ++-- builtin/ls-remote.c | 2 +- builtin/remote.c| 2 +- transport.c | 7 +-- transport.h

[PATCH 25/26] remote-curl: create copy of the service name

2018-01-02 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. Signed-off-by: Brandon Williams --- remote-curl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/remote-curl.

[PATCH 11/26] serve: introduce git-serve

2018-01-02 Thread Brandon Williams
t 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 --- .gitignore | 1 + Documentation/technical/protocol-v2.txt | 91 Mak

[PATCH 17/26] fetch: pass ref patterns when fetching

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

[PATCH 09/26] transport: store protocol version

2018-01-02 Thread Brandon Williams
ned-off-by: Brandon Williams --- transport.c | 35 ++- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/transport.c b/transport.c index 63c3dbab9..2378dcb38 100644 --- a/transport.c +++ b/transport.c @@ -118,6 +118,7 @@ struct git_transport_data {

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

2018-01-02 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 --- builtin/fetch-pack.c | 3 +++ builtin/receive-pack.c | 6 ++ builtin/send-pack.c| 3 +++ connect.c

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

2018-01-02 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 --- transport.c | 18 -- 1 file changed, 4 i

Re: [PATCH] http: fix v1 protocol tests with apache httpd < 2.4

2018-01-02 Thread Brandon Williams
xd.so > > - > - LoadModule setenvif_module modules/mod_setenvif.so > - > > > PassEnv GIT_VALGRIND > @@ -79,9 +79,7 @@ PassEnv ASAN_OPTIONS > PassEnv GIT_TRACE > PassEnv GIT_CONFIG_NOSYSTEM > > -= 2.4> > - SetEnvIf Git-Protocol ".*" GIT_PROTOCOL=$0 > - > +SetEnvIf Git-Protocol ".*" GIT_PROTOCOL=$0 > > Alias /dumb/ www/ > Alias /auth/dumb/ www/auth/dumb/ > -- > 2.16.0.rc0 > -- Brandon Williams

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

2018-01-03 Thread Brandon Williams
On 01/03, Stefan Beller wrote: > On Tue, Jan 2, 2018 at 4:18 PM, Brandon Williams wrote: > > In order to allow for code sharing with the server-side of fetch in > > protocol-v2 convert upload-pack to be a builtin. > > What is the security aspect of this patch? > > By

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

2018-01-05 Thread Brandon Williams
On 01/03, Stefan Beller wrote: > On Tue, Jan 2, 2018 at 4:18 PM, Brandon Williams wrote: > > The current pkt-line API encodes the status of a pkt-line read in the > > length of the read content. An error is indicated with '-1', a flush > > with '0' (which

Re: [PATCH 12/26] ls-refs: introduce ls-refs server command

2018-01-05 Thread Brandon Williams
On 01/03, Stefan Beller wrote: > On Tue, Jan 2, 2018 at 4:18 PM, Brandon Williams wrote: > > Introduce the ls-refs server command. In protocol v2, the ls-refs > > command is used to request the ref advertisement from the server. Since > > it is a command which can be req

Re: [PATCH 20/26] fetch-pack: perform a fetch using v2

2018-01-05 Thread Brandon Williams
On 01/03, Stefan Beller wrote: > On Tue, Jan 2, 2018 at 4:18 PM, Brandon Williams wrote: > > + > > +#define FETCH_CHECK_LOCAL 0 > > +#define FETCH_SEND_REQUEST 1 > > +#define FETCH_PROCESS_ACKS 2 > > +#define FETCH_SEND_HAVES 3 > > +#define FET

Re: [PATCH] upload-pack: fix some sparse warnings

2018-01-08 Thread Brandon Williams
t; > @@ -780,7 +781,7 @@ static int process_deepen(const char *line, int *depth) > if (skip_prefix(line, "deepen ", &arg)) { > char *end = NULL; > *depth = strtol(arg, &end, 0); > - if (!end || *end || depth <= 0) > + if (!end || *end || *depth <= 0) > die("Invalid deepen: %s", line); > return 1; > } > -- > 2.15.0 -- Brandon Williams

Re: [PATCH v3 1/3] read-cache: fix reading the shared index for other repos

2018-01-08 Thread Brandon Williams
index_state struct contain a back pointer to a repository struct. I do think that we may want to have worktree structs contain a back pointer to the struct repository they correspond to. That way there is only one instance of the repository (and object-store once that gets integrated) yet multiple worktrees. -- Brandon Williams

Re: [PATCH 07/26] connect: convert get_remote_heads to use struct packet_reader

2018-01-09 Thread Brandon Williams
On 01/09, Jonathan Tan wrote: > On Tue, 2 Jan 2018 16:18:09 -0800 > Brandon Williams wrote: > > > - while ((len = read_remote_ref(in, &src_buf, &src_len, &responded))) { > > + while (state != EXPECTING_DONE) { > > + switch (packet_reade

Re: [PATCH 09/26] transport: store protocol version

2018-01-09 Thread Brandon Williams
On 01/09, Jonathan Tan wrote: > On Tue, 2 Jan 2018 16:18:11 -0800 > Brandon Williams wrote: > > > diff --git a/transport.c b/transport.c > > index 63c3dbab9..2378dcb38 100644 > > --- a/transport.c > > +++ b/transport.c > > @@ -118,6 +118,7 @@ str

Re: [PATCH 02/26] pkt-line: introduce struct packet_reader

2018-01-09 Thread Brandon Williams
On 01/09, Jonathan Tan wrote: > On Tue, 2 Jan 2018 16:18:04 -0800 > Brandon Williams wrote: > > > diff --git a/pkt-line.h b/pkt-line.h > > index 06c468927..c446e886a 100644 > > --- a/pkt-line.h > > +++ b/pkt-line.h > > @@ -111,6 +111,63 @@ char *pack

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

2018-01-09 Thread Brandon Williams
On 01/09, Jonathan Tan wrote: > On Tue, 2 Jan 2018 16:18:03 -0800 > Brandon Williams wrote: > > > -int packet_read(int fd, char **src_buf, size_t *src_len, > > - char *buffer, unsigned size, int options) > > +enum packet_read_status packet_read_with_statu

Re: [PATCH v1 0/2] Incremental rewrite of git-submodules

2018-01-09 Thread Brandon Williams
shell to C > submodule: port submodule subcommand 'deinit' from shell to C > > builtin/submodule--helper.c | 345 > > git-submodule.sh| 112 +- > 2 files changed, 347 insertions(+), 110 deletions(-) > > -- > 2.14.2 > -- Brandon Williams

Re: [PATCH 11/26] serve: introduce git-serve

2018-01-09 Thread Brandon Williams
On 01/09, Jonathan Tan wrote: > On Tue, 2 Jan 2018 16:18:13 -0800 > Brandon Williams wrote: > > > diff --git a/Documentation/technical/protocol-v2.txt > > b/Documentation/technical/protocol-v2.txt > > new file mode 100644 > > index 0..b87ba3816 > >

Re: [PATCH 11/26] serve: introduce git-serve

2018-01-09 Thread Brandon Williams
On 01/09, Jonathan Tan wrote: > On Tue, 9 Jan 2018 14:16:42 -0800 > Brandon Williams wrote: > > > All good documentation changes. > > Thanks! > > > > > + /* > > > > +* Function called when a client requests the capability as a

Re: [PATCH] run-command.c: print env vars when GIT_TRACE is set

2018-01-10 Thread Brandon Williams
const char *format, ...); > -__attribute__((format (printf, 4, 5))) > -extern void trace_argv_printf_fl(const char *file, int line, const char > **argv, > +__attribute__((format (printf, 5, 6))) > +extern void trace_argv_printf_fl(const char *file, int line, > + const char *const *env, const char **argv, >const char *format, ...); > extern void trace_strbuf_fl(const char *file, int line, struct trace_key > *key, > const struct strbuf *data); > -- > 2.15.1.600.g899a5f85c6 > -- Brandon Williams

Re: [PATCH] run-command.c: print env vars when GIT_TRACE is set

2018-01-10 Thread Brandon Williams
On 01/10, Stefan Beller wrote: > On Wed, Jan 10, 2018 at 10:09 AM, Brandon Williams wrote: > > At first when i read this I was under the impression that the whole > > environment was going to be printed out...but i now realize that this > > tracing will only print o

Re: [PATCH 00/26] protocol version 2

2018-01-10 Thread Brandon Williams
On 01/09, Jonathan Tan wrote: > On Tue, 2 Jan 2018 16:18:02 -0800 > Brandon Williams wrote: > > > * Introduce a new remote-helper command 'connect-half-duplex' which is > >implemented by remote-curl (the http remote-helper). This allows for a > >

Re: [PATCH 26/26] remote-curl: implement connect-half-duplex command

2018-01-10 Thread Brandon Williams
On 01/10, Jonathan Tan wrote: > On Tue, 2 Jan 2018 16:18:28 -0800 > Brandon Williams wrote: > > > +static size_t proxy_in(void *ptr, size_t eltsize, > > + size_t nmemb, void *buffer_) > > OK, I managed to look at the Curl stuff in more detail. >

Re: Unable to de-init stubborn submodule

2018-01-11 Thread Brandon Williams
siondetection/../.git/modules/sha1collisiondetection > > But I can't see what's still referencing it. > > This problem is avoided if, as noted with a comment I skip: > > git submodule update --init > > But I shouldn't need to remember to de-init a submodule before moving to > a new commit that doesn't have it, least I end up in some seemingly > unrecoverable state. > > Am I missing something obvious here? One thing you could try is adding --recurse-submodule flags to the reset commands. IIRC reset ignores submodules unless you specify that flag. -- Brandon Williams

Re: [PATCH v2] run-command.c: print env vars when GIT_TRACE is set

2018-01-11 Thread Brandon Williams
gt; index 88055abef7..e54c687f26 100644 > --- a/trace.h > +++ b/trace.h > @@ -4,6 +4,8 @@ > #include "git-compat-util.h" > #include "strbuf.h" > > +struct child_process; > + > struct trace_key { > const char * const key; > int fd; > @@ -17,6 +19,7 @@ extern struct trace_key trace_default_key; > extern struct trace_key trace_perf_key; > > extern void trace_repo_setup(const char *prefix); > +extern void trace_run_command(const struct child_process *cp); > extern int trace_want(struct trace_key *key); > extern void trace_disable(struct trace_key *key); > extern uint64_t getnanotime(void); > -- > 2.15.1.600.g899a5f85c6 > -- Brandon Williams

Re: [PATCH v3 4/4] trace.c: be smart about what env to print in trace_run_command()

2018-01-12 Thread Brandon Williams
it > might be worth it (not so much for code de-duping, but because then we > would know our display logic always matched what we exec'd). But unless > somebody wants to refactor all of the Windows spawn code, it's > definitely not a good idea. And not having access to a windows box I didn't want to try and refactor the windows-only code when I introduced prep_childenv() :) -- Brandon Williams

Re: [PATCH v5 3/7] trace.c: move strbuf_release() out of print_trace_line()

2018-01-16 Thread Brandon Williams
On 01/15, Nguyễn Thái Ngọc Duy wrote: > The function is about printing a trace line, not releasing the buffer it > receives too. Move strbuf_release() back outside. This makes it easier > to see how strbuf is managed. This makes the code much more readable. -- Brandon Williams

Re: [PATCH v5 6/7] trace.c: print env vars in trace_run_command()

2018-01-16 Thread Brandon Williams
(compared to parent environment) in this case. > Code looks clean and very readable. Also matches the last one wins semantics in prep_childenv. -- Brandon Williams

Re: [PATCH 12/26] ls-refs: introduce ls-refs server command

2018-01-16 Thread Brandon Williams
On 01/09, Jonathan Tan wrote: > On Tue, 2 Jan 2018 16:18:14 -0800 > Brandon Williams wrote: > > > + symrefs: In addition to the object pointed by it, show the underlying > > + ref pointed by it when showing a symbolic ref. > > + peel: Show peeled tags. > >

Re: [PATCH v3 1/3] read-cache: fix reading the shared index for other repos

2018-01-16 Thread Brandon Williams
So the sharedindex file is always located relative to the project's git directory and not the index file itself, which is kind of confusing. Maybe a better design would be to have the sharedindex file located relative to the index file. Anyway, some food for thought. -- Brandon Williams

Re: [PATCH v3 1/3] read-cache: fix reading the shared index for other repos

2018-01-16 Thread Brandon Williams
On 01/17, Duy Nguyen wrote: > On Wed, Jan 17, 2018 at 4:42 AM, Brandon Williams wrote: > > On 01/07, Thomas Gummerer wrote: > >> read_index_from() takes a path argument for the location of the index > >> file. For reading the shared index in split index mode howeve

Re: [PATCH 6/5] run-command: avoid potential dangers in forked child

2017-04-11 Thread Brandon Williams
ng, and then just use execv(e) since it shouldn't have any calls to malloc in them correct? -- Brandon Williams

Re: [PATCH v3 0/5] propagating push-options, remote and refspec

2017-04-11 Thread Brandon Williams
On 04/11, Junio C Hamano wrote: > Brandon Williams writes: > > > v3 builds upon v2 by adding 3 additional patches to add functionality to > > also > > propagate the remote and refspec down to children process's working to push > > submodules. The remote and

Re: [PATCH 11/12] grep: change the internal PCRE code & header names to be PCRE1

2017-04-11 Thread Brandon Williams
one in the grep code, but it might be slightly more involved than just changing the enum name. >From [12/12] it looks like the main purpose of this series is to use a more preferment version of PCRE, if all else is equal it doesn't really make much sense to have both versions to be select-able at runtime. Is there any benefit of being able to do that, that I'm missing? -- Brandon Williams

Re: [PATCH 6/5] run-command: avoid potential dangers in forked child

2017-04-11 Thread Brandon Williams
On 04/11, Eric Wong wrote: > Brandon Williams wrote: > > On 04/11, Eric Wong wrote: > > > Hi Brandon, this series tickles an old itch of mine, so I > > > started working off of it. I'm only somewhat concerned > > > with the path resolution in execvp(e)

Re: [PATCH 4/5] run-command: prepare child environment before forking

2017-04-11 Thread Brandon Williams
On 04/10, Jonathan Nieder wrote: > Brandon Williams wrote: > > > In order to avoid allocation between 'fork()' and 'exec()' prepare the > > environment to be used in the child process prior to forking. > > If using something like posix_spawn(), this

Re: [PATCH 5/5] run-command: add note about forking and threading

2017-04-11 Thread Brandon Williams
> exec() in the normal control flow. You have to worry about signal > > handlers, too. > > Yes, all that auditing is necessary for vfork; too, but totally > doable. The mainline Ruby implementation has been using vfork > for spawning subprocesses for several years, now; an

Re: [PATCH 0/5] forking and threading

2017-04-11 Thread Brandon Williams
On 04/11, Jonathan Nieder wrote: > Brandon Williams wrote: > Jonathan Tan had an idea about how to side-step the issue: what if > "grep" forks an appropriate set of child processes before creating any > threads and then communicates with those children using pipes? > Bec

Re: [PATCH] ls-files: properly prepare submodule environment

2017-04-12 Thread Brandon Williams
from a subdir' ' > + test_when_finished "rm -rf parent sub" && > + git init sub && > + echo "foobar" >sub/file && > + git -C sub add file && > + git -C sub commit -m "add file" && > + > + git init parent && > + mkdir parent/src && > + echo "foobar" >parent/src/file && > + git -C parent add src/file && > + git -C parent submodule add ../sub src/sub && > + git -C parent submodule add ../sub sub && > + git -C parent commit -m "add files and submodules" && > + > + # Verify grep from root works > + cat >expect <<-\EOF && > + .gitmodules > + src/file > + src/sub/file > + sub/file > + EOF > + git -C parent ls-files --recurse-submodules >actual && > + test_cmp expect actual && > + > + # Verify grep from a subdir works > + cat >expect <<-\EOF && > + file > + sub/file > + EOF > + git -C parent/src ls-files --recurse-submodules >actual && > + test_cmp expect actual > +' > + > +test_incompatible_with_recurse_submodules () > +{ > + test_expect_success "--recurse-submodules and $1 are incompatible" " > + test_must_fail git ls-files --recurse-submodules $1 2>actual && > + test_i18ngrep -- '--recurse-submodules unsupported mode' actual > + " > +} > + > +test_incompatible_with_recurse_submodules --deleted > +test_incompatible_with_recurse_submodules --others > +test_incompatible_with_recurse_submodules --unmerged > +test_incompatible_with_recurse_submodules --killed > +test_incompatible_with_recurse_submodules --modified > + > +test_done > -- > 2.12.2.776.gded3dc243c29.dirty > -- Brandon Williams

Re: [PATCH 1/5] run-command: convert sane_execvp to sane_execvpe

2017-04-12 Thread Brandon Williams
On 04/10, Brandon Williams wrote: > Convert 'sane_execvp()' to 'sane_execvpe()' which optionally takes a > pointer to an array of 'char *' which should be used as the environment > for the process being exec'd. If no environment is provided (by passi

Re: [PATCH v2 1/2] ls-files: fix recurse-submodules with nested submodules

2017-04-13 Thread Brandon Williams
.sh > index 4cf6ccf5a8ea..c8030dd3299a 100755 > --- a/t/t3007-ls-files-recurse-submodules.sh > +++ b/t/t3007-ls-files-recurse-submodules.sh > @@ -77,6 +77,7 @@ test_expect_success 'ls-files recurses more than 1 level' ' > git -C submodule/subsub commit -m "add d" && > git -C submodule submodule add ./subsub && > git -C submodule commit -m "added subsub" && > + git submodule absorbgitdirs && > git ls-files --recurse-submodules >actual && > test_cmp expect actual > ' > -- > 2.12.2.776.gded3dc243c29.dirty > -- Brandon Williams

Re: [PATCH v2 2/2] ls-files: fix path used when recursing into submodules

2017-04-13 Thread Brandon Williams
t I'm not sure...) Additionally, > it felt weird that there's no helper function for creating a toplevel > relative path. I never considered the case where you use --git-dir or --work-tree, definitely an oversight on my part. This change seems reasonable to me. -- Brandon Williams

[PATCH v2 0/6] forking and threading

2017-04-13 Thread Brandon Williams
afe. This means that fork/exec in a threaded context should work without deadlock and we could potentially move to using vfork instead of fork, though I'll let others more experienced make that decision. Brandon Williams (6): t5550: use write_script to generate post-update hook run-command: p

[PATCH v2 5/6] run-command: eliminate calls to error handling functions in child

2017-04-13 Thread Brandon Williams
reporting happens from the parent; even avoiding functions like atexit(3) and exit(3). Helped-by: Eric Wong Signed-off-by: Brandon Williams --- run-command.c | 121 ++ 1 file changed, 89 insertions(+), 32 deletions(-) diff --git a/run-command.c

[PATCH v2 1/6] t5550: use write_script to generate post-update hook

2017-04-13 Thread Brandon Williams
The post-update hooks created in t5550-http-fetch-dumb.sh is missing the "!#/bin/sh" line which can cause issues with portability. Instead create the hook using the 'write_script' function which includes the proper "#!" line. Signed-off-by: Brandon Williams ---

[PATCH v2 4/6] run-command: don't die in child when duping /dev/null

2017-04-13 Thread Brandon Williams
Signed-off-by: Brandon Williams --- run-command.c | 28 +--- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/run-command.c b/run-command.c index 5e2a03145..6751b8319 100644 --- a/run-command.c +++ b/run-command.c @@ -117,18 +117,6 @@ static inline void

[PATCH v2 6/6] run-command: add note about forking and threading

2017-04-13 Thread Brandon Williams
of the code know to only use Async-Signal-Safe functions in the child process. Signed-off-by: Brandon Williams --- run-command.c | 9 + 1 file changed, 9 insertions(+) diff --git a/run-command.c b/run-command.c index 4230c4933..1c36e692d 100644 --- a/run-command.c +++ b/run-command.c @@

[PATCH v2 3/6] run-command: prepare child environment before forking

2017-04-13 Thread Brandon Williams
In order to avoid allocation between 'fork()' and 'exec()' prepare the environment to be used in the child process prior to forking. Switch to using 'execve()' so that the construct child environment can used in the exec'd process. Signed-off-by: Brando

[PATCH v2 2/6] run-command: prepare command before forking

2017-04-13 Thread Brandon Williams
the potential to call malloc during the path resolution it performs. Instead we simply do the path resolution ourselves during the preparation stage prior to forking. Signed-off-by: Brandon Williams --- run-command.c | 60 +++ 1 file

Re: [PATCH v2 1/2] ls-files: fix recurse-submodules with nested submodules

2017-04-13 Thread Brandon Williams
in the abstractions that we'd need. Agreed, though we're probably pretty far from that becoming a reality. One day though! -- Brandon Williams

<    5   6   7   8   9   10   11   12   13   14   >