[PATCH v2 6/4] diff: remove DIFF_OPT_SET macro

2017-10-30 Thread Brandon Williams
; identifier fld; @@ - DIFF_OPT_SET(ptr, fld) + ptr->flags.fld = 1 Signed-off-by: Brandon Williams <bmw...@google.com> --- blame.c | 8 +++ builtin/add.c | 4 ++-- builtin/am.c | 8 +++ builtin/blame.c | 4 ++--

[PATCH v2 5/4] diff: remove DIFF_OPT_TST macro

2017-10-30 Thread Brandon Williams
; identifier fld; @@ - DIFF_OPT_TST(ptr, fld) + ptr->flags.fld Signed-off-by: Brandon Williams <bmw...@google.com> --- blame.c| 8 +++--- builtin/am.c | 2 +- builtin/blame.c| 4 +-- builtin/diff.c | 2 +- builtin/log.c

[PATCH v2 8/4] diff: make struct diff_flags members lowercase

2017-10-30 Thread Brandon Williams
; @@ - E.DEFAULT_FOLLOW_RENAMES + E.default_follow_renames Signed-off-by: Brandon Williams <bmw...@google.com> --- blame.c | 16 ++--- builtin/add.c | 4 +- builtin/am.c | 10 +-- builtin/blame.c | 10 +-- builtin/commit.c | 4 +- builtin/

Re: [PATCH v2 3/4] diff: add flag to indicate textconv was set via cmdline

2017-10-30 Thread Brandon Williams
On 10/30, Brandon Williams wrote: > On 10/30, Stefan Beller wrote: > > On Mon, Oct 30, 2017 at 12:46 PM, Brandon Williams <bmw...@google.com> > > wrote: > > > git-show is unique in that it wants to use textconv by default except > > > for when it is showing

Re: [PATCH v2 3/4] diff: add flag to indicate textconv was set via cmdline

2017-10-30 Thread Brandon Williams
On 10/30, Stefan Beller wrote: > On Mon, Oct 30, 2017 at 12:46 PM, Brandon Williams <bmw...@google.com> wrote: > > git-show is unique in that it wants to use textconv by default except > > for when it is showing blobs. When asked to show a blob, show doesn't > >

[PATCH v2 3/4] diff: add flag to indicate textconv was set via cmdline

2017-10-30 Thread Brandon Williams
is requested via the command line. Signed-off-by: Brandon Williams <bmw...@google.com> --- builtin/log.c | 2 +- diff.c| 8 +--- diff.h| 1 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/builtin/log.c b/builtin/log.c index dc28d43eb..82131751d

[PATCH v2 4/4] diff: remove touched flags

2017-10-30 Thread Brandon Williams
Now that the set of parallel touched flags are no longer being used, remove them. Signed-off-by: Brandon Williams <bmw...@google.com> --- builtin/log.c | 2 -- diff.h| 6 ++ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/builtin/log.c b/builtin/log.c index 821

[PATCH v2 2/4] diff: convert flags to be stored in bitfields

2017-10-30 Thread Brandon Williams
diff_flags'. Signed-off-by: Brandon Williams <bmw...@google.com> --- builtin/commit.c | 7 ++-- builtin/log.c| 3 +- diff-lib.c | 7 ++-- diff.c | 2 +- diff.h | 97 +--- sequencer.c | 5 +-- 6 files chang

[PATCH v2 0/4] convert diff flags to be stored in a struct

2017-10-30 Thread Brandon Williams
lower case). If that's what we want to do, I can go ahead and send those patches out as a follow on to these. Brandon Williams (4): add, reset: use DIFF_OPT_SET macro to set a diff flag diff: convert flags to be stored in bitfields diff: add flag to indicate textconv was set via cmdline diff

[PATCH v2 1/4] add, reset: use DIFF_OPT_SET macro to set a diff flag

2017-10-30 Thread Brandon Williams
Instead of explicitly setting the 'DIFF_OPT_OVERRIDE_SUBMODULE_CONFIG' flag, use the 'DIFF_OPT_SET' macro. Signed-off-by: Brandon Williams <bmw...@google.com> --- builtin/add.c | 2 +- builtin/reset.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin/a

Re: [PATCH 3/3] diff: convert flags to be stored in bitfields

2017-10-30 Thread Brandon Williams
amed diff_flags_none or > diff_flags_empty, I guess. I have a new version of the series I'll send out and i ended up dropping it entirely. Didn't even need a clear function because I was able to drop the touched stuff and it would have only been used inside of builtin/log.c to clear the touched flags. -- Brandon Williams

Re: [PATCH 2/3] reset: use DIFF_OPT_SET macro to set a diff flag

2017-10-30 Thread Brandon Williams
On 10/29, Junio C Hamano wrote: > Brandon Williams <bmw...@google.com> writes: > > > Instead of explicitly setting the 'DIFF_OPT_OVERRIDE_SUBMODULE_CONFIG' > > flag, use the 'DIFF_OPT_SET' macro. > > > > Signed-off-by: Brandon Williams <bmw...@google.com&g

Re: [PATCH 3/3] diff: convert flags to be stored in bitfields

2017-10-30 Thread Brandon Williams
On 10/29, Junio C Hamano wrote: > Brandon Williams <bmw...@google.com> writes: > > > We have have reached the limit of the number of flags that can be stored > > s/have have/have/; but bit #9 is unused. > > "We cannot add many more flags even if we wanted to

[PATCH 0/3] convert diff flags to be stored in a struct

2017-10-27 Thread Brandon Williams
its only used in one place) and then we may even be able to stop needing to use macros to set/clr/test the flags. Brandon Williams (3): add: use DIFF_OPT_SET macro to set a diff flag reset: use DIFF_OPT_SET macro to set a diff flag diff: convert flags to be stored in bitfields builtin

[PATCH 2/3] reset: use DIFF_OPT_SET macro to set a diff flag

2017-10-27 Thread Brandon Williams
Instead of explicitly setting the 'DIFF_OPT_OVERRIDE_SUBMODULE_CONFIG' flag, use the 'DIFF_OPT_SET' macro. Signed-off-by: Brandon Williams <bmw...@google.com> --- builtin/reset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/reset.c b/builtin/reset.c index 9cd

[PATCH 1/3] add: use DIFF_OPT_SET macro to set a diff flag

2017-10-27 Thread Brandon Williams
Instead of explicitly setting the 'DIFF_OPT_OVERRIDE_SUBMODULE_CONFIG' flag, use the 'DIFF_OPT_SET' macro. Signed-off-by: Brandon Williams <bmw...@google.com> --- builtin/add.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/add.c b/builtin/add.c index a64

[PATCH 3/3] diff: convert flags to be stored in bitfields

2017-10-27 Thread Brandon Williams
We have have reached the limit of the number of flags that can be stored in a single unsigned int. In order to allow for more flags to be added to the diff machinery in the future this patch converts the flags to be stored in bitfields in 'struct diff_flags'. Signed-off-by: Brandon Williams <

Re: [WIP PATCH] diff: add option to ignore whitespaces for move detection only

2017-10-25 Thread Brandon Williams
On 10/25, Junio C Hamano wrote: > Junio C Hamano <gits...@pobox.com> writes: > > > Brandon Williams <bmw...@google.com> writes: > > > >> One simple idea would be to convert the single 'flag' into various bit > >> fields themselves, that way if you

Re: [RFC] protocol version 2

2017-10-25 Thread Brandon Williams
On 10/25, Derrick Stolee wrote: > On 10/20/2017 1:18 PM, Brandon Williams wrote: > > Overview > >== > > > >This document presents a specification for a version 2 of Git's wire > >protocol. Protocol v2 will improve upon v1 in the following ways: > &

Re: [WIP PATCH] diff: add option to ignore whitespaces for move detection only

2017-10-24 Thread Brandon Williams
lag you would just make a new bit field. I'm unaware of any downsides of doing so (though i may be missing something) but doing so would probably cause a bit of code churn. -- Brandon Williams

Re: [RFC] protocol version 2

2017-10-24 Thread Brandon Williams
On 10/24, Junio C Hamano wrote: > Brandon Williams <bmw...@google.com> writes: > > > * Capabilities were implemented as a hack and are hidden behind a NUL > > byte after the first ref sent from the server during the ref > > advertisement: > > ... >

Re: [PATCH 3/5] ssh: 'auto' variant to select between 'ssh' and 'simple'

2017-10-23 Thread Brandon Williams
; +++ b/t/t5601-clone.sh > @@ -372,6 +372,12 @@ test_expect_success 'variant can be overriden' ' > expect_ssh myhost src > ' > > +test_expect_success 'variant=auto picks based on basename' ' > + copy_ssh_wrapper_as "$TRASH_DIRECTORY/plink" && > + git -c ssh.variant=auto clone -4 "[myhost:123]:src" ssh-auto-clone && > + expect_ssh "-4 -P 123" myhost src > +' > + > test_expect_success 'simple is treated as simple' ' > copy_ssh_wrapper_as "$TRASH_DIRECTORY/simple" && > git clone -4 "[myhost:123]:src" ssh-bracket-clone-simple && > @@ -384,6 +390,20 @@ test_expect_success 'uplink is treated as simple' ' > expect_ssh myhost src > ' > > +test_expect_success 'OpenSSH-like uplink is treated as ssh' ' > + write_script "$TRASH_DIRECTORY/uplink" <<-EOF && > + if test "\$1" = "-G" > + then > + exit 0 > + fi && > + exec "\$TRASH_DIRECTORY/ssh$X" "\$@" > + EOF > + GIT_SSH="$TRASH_DIRECTORY/uplink" && > + export GIT_SSH && > + git clone "[myhost:123]:src" ssh-bracket-clone-sshlike-uplink && > + expect_ssh "-p 123" myhost src > +' > + > test_expect_success 'plink is treated specially (as putty)' ' > copy_ssh_wrapper_as "$TRASH_DIRECTORY/plink" && > git clone "[myhost:123]:src" ssh-bracket-clone-plink-0 && > -- > 2.15.0.rc1.287.g2b38de12cc > -- Brandon Williams

Re: [PATCH 3/5] ssh: 'auto' variant to select between 'ssh' and 'simple'

2017-10-23 Thread Brandon Williams
> index 11fa516997..f9a2ae84c7 100755 > --- i/t/t5601-clone.sh > +++ w/t/t5601-clone.sh > @@ -373,6 +373,12 @@ test_expect_success 'variant can be overridden' ' > expect_ssh "-4 -P 123" myhost src > ' > > +test_expect_success 'variant=auto picks based on basename' ' > + copy_ssh_wrapper_as "$TRASH_DIRECTORY/plink" && > + git -c ssh.variant=auto clone -4 "[myhost:123]:src" ssh-auto-clone && > + expect_ssh "-4 -P 123" myhost src > +' > + > test_expect_success 'simple does not support -4/-6' ' > copy_ssh_wrapper_as "$TRASH_DIRECTORY/simple" && > test_must_fail git clone -4 "myhost:src" ssh-4-clone-simple -- Brandon Williams

[RFC] protocol version 2

2017-10-20 Thread Brandon Williams
Objective === Replace Git's current wire protocol with a simpler, less wasteful protocol that can evolve over time. Background Git's wire protocol is the language used to clone/fetch/push from/to a remote git repository. A detailed explanation of the current protocol

Re: [PATCH/RFC] grep: turn off threading when recursing submodules

2017-10-19 Thread Brandon Williams
handle_builtin.lto_priv.1929 git.c:554 > #5 run_argv git.c:606 > #6 cmd_main git.c:683 > #7 main common-main.c:43 > > Thread T4 (tid=27212, running) created by main thread at: > #0 pthread_create > #1 start_threads builtin/grep.c:223 > #2 cmd_grep builtin/grep.c:1047 > #3 run_builtin git.c:346 > #4 handle_builtin.lto_priv.1929 git.c:554 > #5 run_argv git.c:606 > #6 cmd_main git.c:683 > #7 main common-main.c:43 > > SUMMARY: ThreadSanitizer: data race sha1_file.c:361 link_alt_odb_entry > > -- > 2.15.0.rc1.71.g1477d2401 > -- Brandon Williams

Re: [PATCH v4 3/3] submodule: simplify decision tree whether to or not to fetch

2017-10-19 Thread Brandon Williams
On 10/19, Heiko Voigt wrote: > On Thu, Oct 19, 2017 at 09:36:47AM +0900, Junio C Hamano wrote: > > Brandon Williams <bmw...@google.com> writes: > > > > > On 10/16, Heiko Voigt wrote: > > >> To make extending this logic later easier. > > &

Re: How can I debug git source code interactively with debugger like gdb?

2017-10-18 Thread Brandon Williams
able 'GIT_TEST_GDB' is set. This will launch it under gdb. For example: GIT_TEST_GDB=1 ./bin-wrappers/git status -- Brandon Williams

Re: [PATCH v4 3/3] submodule: simplify decision tree whether to or not to fetch

2017-10-18 Thread Brandon Williams
ookup(_submodule_names, >submodule->name)) > continue; > default_argv = "on-demand"; > + break; > + case RECURSE_SUBMODULES_ON: > + default_argv = "yes"; > + break; > + case RECURSE_SUBMODULES_OFF: > + continue; > } > > strbuf_addf(_path, "%s/%s", spf->work_tree, ce->name); > -- > 2.14.1.145.gb3622a4 > -- Brandon Williams

Re: Is t5601 flaky for anybody else?

2017-10-17 Thread Brandon Williams
TRASH_DIRECTORY/ssh-wrapper$X" && > GIT_SSH="$TRASH_DIRECTORY/ssh-wrapper$X" && > @@ -318,6 +319,7 @@ setup_ssh_wrapper () { > } > > copy_ssh_wrapper_as () { > + rm -f "${1%$X}$X" && > cp "$TRASH_DIRECTORY/ssh-wrapper$X" "${1%$X}$X" && > GIT_SSH="${1%$X}$X" && > export GIT_SSH -- Brandon Williams

[PATCH v4 11/11] Documentation: document Extra Parameters

2017-10-16 Thread Brandon Williams
From: Jonathan Tan <jonathanta...@google.com> Document the server support for Extra Parameters, additional information that the client can send in its first message to the server during a Git client-server interaction. Signed-off-by: Jonathan Tan <jonathanta...@google.com> Signed-off

[PATCH v4 10/11] ssh: introduce a 'simple' ssh variant

2017-10-16 Thread Brandon Williams
y: Jeffrey Yasskin <jyass...@google.com> Signed-off-by: Brandon Williams <bmw...@google.com> --- Documentation/config.txt | 27 ++-- Documentation/git.txt| 9 ++-- connect.c| 108 ++- t/t5601-clone.sh

[PATCH v4 00/11] protocol transition

2017-10-16 Thread Brandon Williams
protocol version isn't accounted for in these switch statements. * Added Jonathan's Documentation patch ontop of the series (with the small change I pointed out in reply to the patch itself) * A few other small changes due to reviewer comments. Brandon Williams (9): pkt-line: add

[PATCH v4 08/11] http: tell server that the client understands v1

2017-10-16 Thread Brandon Williams
Tell a server that protocol v1 can be used by sending the http header 'Git-Protocol' with 'version=1' indicating this. Also teach the apache http server to pass through the 'Git-Protocol' header as an environment variable 'GIT_PROTOCOL'. Signed-off-by: Brandon Williams <bmw...@google.

[PATCH v4 01/11] connect: in ref advertisement, shallows are last

2017-10-16 Thread Brandon Williams
inting a warning message when encountering capabilities on other lines. Signed-off-by: Jonathan Tan <jonathanta...@google.com> Signed-off-by: Brandon Williams <bmw...@google.com> --- connect.c | 189 -- 1 file changed, 123 insertion

[PATCH v4 06/11] connect: teach client to recognize v1 server response

2017-10-16 Thread Brandon Williams
Teach a client to recognize that a server understands protocol v1 by looking at the first pkt-line the server sends in response. This is done by looking for the response "version 1" send by upload-pack or receive-pack. Signed-off-by: Brandon Williams <bmw...@google.com> ---

[PATCH v4 02/11] pkt-line: add packet_write function

2017-10-16 Thread Brandon Williams
Add a function which can be used to write the contents of an arbitrary buffer. This makes it easy to build up data in a buffer before writing the packet instead of formatting the entire contents of the packet using 'packet_write_fmt()'. Signed-off-by: Brandon Williams <bmw...@google.

[PATCH v4 04/11] daemon: recognize hidden request arguments

2017-10-16 Thread Brandon Williams
rg" part of the command, 2009-06-04) because both of these versions of git-daemon check for a single NUL byte after the host argument before terminating the argument parsing. Signed-off-by: Brandon Williams <bmw...@google.com> --- daemon.c | 71 ++

[PATCH v4 05/11] upload-pack, receive-pack: introduce protocol version 1

2017-10-16 Thread Brandon Williams
version being spoken. Signed-off-by: Brandon Williams <bmw...@google.com> --- builtin/receive-pack.c | 17 + upload-pack.c | 20 +++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c

[PATCH v4 07/11] connect: tell server that the client understands v1

2017-10-16 Thread Brandon Williams
his environment variable. Signed-off-by: Brandon Williams <bmw...@google.com> --- connect.c | 37 ++-- t/t5700-protocol-v1.sh | 223 + 2 files changed, 255 insertions(+), 5 deletions(-) create mode 100755 t/t5700-protocol-v

[PATCH v4 09/11] i5700: add interop test for protocol transition

2017-10-16 Thread Brandon Williams
Signed-off-by: Brandon Williams <bmw...@google.com> --- t/interop/i5700-protocol-transition.sh | 68 ++ 1 file changed, 68 insertions(+) create mode 100755 t/interop/i5700-protocol-transition.sh diff --git a/t/interop/i5700-protocol-transition.sh b/t/i

[PATCH v4 03/11] protocol: introduce protocol extension mechanisms

2017-10-16 Thread Brandon Williams
. Unknown keys and values must be tolerated. This mechanism is used to communicate which version of the wire protocol a client would like to use with a server. Signed-off-by: Brandon Williams <bmw...@google.com> --- Documentation/config.txt | 17 +++ Documentation/git.txt| 6 Ma

Re: [PATCH v3 10/10] ssh: introduce a 'simple' ssh variant

2017-10-16 Thread Brandon Williams
On 10/03, Jonathan Nieder wrote: > Hi, > > Brandon Williams wrote: > > > When using the 'ssh' transport, the '-o' option is used to specify an > > environment variable which should be set on the remote end. This allows > > git to send additional informat

Re: [PATCH v3 07/10] connect: tell server that the client understands v1

2017-10-13 Thread Brandon Williams
On 10/10, Jonathan Tan wrote: > On Tue, 3 Oct 2017 13:15:04 -0700 > Brandon Williams <bmw...@google.com> wrote: > > > 2. ssh://, file:// > >Set 'GIT_PROTOCOL' environment variable with the desired protocol > >version. With the file:// tra

Re: [PATCH v3 03/10] protocol: introduce protocol extention mechanisms

2017-10-13 Thread Brandon Williams
On 10/10, Jonathan Nieder wrote: > Hi, > > Brandon Williams wrote: > > > Given some of this discussion though, maybe we want to change the > > semantics of 'protocol.version' so that both servers and clients respect > > it. As of right now, these patche

Re: [PATCH] Documentation: document Extra Parameters

2017-10-13 Thread Brandon Williams
4git-upload-pack > /schacon/gitbook.git\0host=example.com\0\0version=1\0" | >nc -v example.com 9418 > + 000aversion 1 > 00887217a7c7e582c46cec22a130adf4b9d7d950fba0 HEAD\0multi_ack thin-pack > side-band side-band-64k ofs-delta shallow no-progress > include-tag > 00441d3fcd5ced445d1abc402225c0b8a1299641f497 refs/heads/integration > @@ -165,7 +193,8 @@ immediately after the ref itself, if presented. A > conforming server > MUST peel the ref if it's an annotated tag. > > > - advertised-refs = (no-refs / list-of-refs) > + advertised-refs = *1("version 1") > + (no-refs / list-of-refs) > *shallow > flush-pkt > > -- > 2.14.2.920.gcf0c67979c-goog > -- Brandon Williams

Re: [PATCH v3 05/10] upload-pack, receive-pack: introduce protocol version 1

2017-10-13 Thread Brandon Williams
On 10/10, Jonathan Tan wrote: > On Tue, 3 Oct 2017 13:15:02 -0700 > Brandon Williams <bmw...@google.com> wrote: > > > + switch (determine_protocol_version_server()) { > > + case protocol_v1: > > + if (advertise_refs || !stateless_rpc) > >

Re: [PATCH v3 04/10] daemon: recognize hidden request arguments

2017-10-13 Thread Brandon Williams
On 10/10, Jonathan Tan wrote: > On Tue, 3 Oct 2017 13:15:01 -0700 > Brandon Williams <bmw...@google.com> wrote: > > > /* > > * Read the host as supplied by the client connection. > > The return value is probably worth documenting. Something like "Retur

Re: [RFC PATCH 2/4] change submodule push test to use proper repository setup

2017-10-12 Thread Brandon Williams
jecting or complaining about > repositories that have gitlinks without a .gitmodules file. That's good to know! And from what I remember, with the commands we've begun teaching to understand submodules we have been requiring a .gitmodules entry for a submodule in order to do the recursion, and a gitlink without a .gitmodules entry would simply be ignored or skipped. -- Brandon Williams

Re: [PATCH v3 03/10] protocol: introduce protocol extention mechanisms

2017-10-10 Thread Brandon Williams
re 'required' to respect. So I agree with Martin here that if more complicated use cases arise we can design in a preference system for them at a later time. Given some of this discussion though, maybe we want to change the semantics of 'protocol.version' so that both servers and clients respect it. As of right now, these patches have the server always allow protocol v0 and v1? Though that doesn't do much right now since v1 is the same as v0. One other considerations that I should probably handle is that a client doesn't do any verification right now to ensure that the protocol version the server selects was indeed the protocol that the client requested. Is that something you think we need to check for? -- Brandon Williams

[PATCH v3 06/10] connect: teach client to recognize v1 server response

2017-10-03 Thread Brandon Williams
Teach a client to recognize that a server understands protocol v1 by looking at the first pkt-line the server sends in response. This is done by looking for the response "version 1" send by upload-pack or receive-pack. Signed-off-by: Brandon Williams <bmw...@google.com> ---

[PATCH v3 10/10] ssh: introduce a 'simple' ssh variant

2017-10-03 Thread Brandon Williams
he command-line options sent to ssh commands based on their variant. Reported-by: Jeffrey Yasskin <jyass...@google.com> Signed-off-by: Brandon Williams <bmw...@google.com> --- Documentation/config.txt | 27 ++-- Documentation/git.txt| 9 ++-- connect.

[PATCH v3 07/10] connect: tell server that the client understands v1

2017-10-03 Thread Brandon Williams
ning git-upload-pack or git-receive-pack processes. With the ssh:// transport and OpenSSH compliant ssh programs, 'GIT_PROTOCOL' can be sent across ssh by using '-o SendEnv=GIT_PROTOCOL' and having the server whitelist this environment variable. Signed-off-by: Brandon Williams <bmw...@go

[PATCH v3 08/10] http: tell server that the client understands v1

2017-10-03 Thread Brandon Williams
Tell a server that protocol v1 can be used by sending the http header 'Git-Protocol' indicating this. Also teach the apache http server to pass through the 'Git-Protocol' header as an environment variable 'GIT_PROTOCOL'. Signed-off-by: Brandon Williams <bmw...@google.com> --- c

[PATCH v3 02/10] pkt-line: add packet_write function

2017-10-03 Thread Brandon Williams
Add a function which can be used to write the contents of an arbitrary buffer. This makes it easy to build up data in a buffer before writing the packet instead of formatting the entire contents of the packet using 'packet_write_fmt()'. Signed-off-by: Brandon Williams <bmw...@google.

[PATCH v3 01/10] connect: in ref advertisement, shallows are last

2017-10-03 Thread Brandon Williams
inting a warning message when encountering capabilities on other lines. Signed-off-by: Jonathan Tan <jonathanta...@google.com> Signed-off-by: Brandon Williams <bmw...@google.com> --- connect.c | 189 -- 1 file changed, 123 insertion

[PATCH v3 05/10] upload-pack, receive-pack: introduce protocol version 1

2017-10-03 Thread Brandon Williams
version being spoken. Signed-off-by: Brandon Williams <bmw...@google.com> --- builtin/receive-pack.c | 15 +++ upload-pack.c | 18 +- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index dd0

[PATCH v3 09/10] i5700: add interop test for protocol transition

2017-10-03 Thread Brandon Williams
Signed-off-by: Brandon Williams <bmw...@google.com> --- t/interop/i5700-protocol-transition.sh | 68 ++ 1 file changed, 68 insertions(+) create mode 100755 t/interop/i5700-protocol-transition.sh diff --git a/t/interop/i5700-protocol-transition.sh b/t/i

[PATCH v3 04/10] daemon: recognize hidden request arguments

2017-10-03 Thread Brandon Williams
rg" part of the command, 2009-06-04) because both of these versions of git-daemon check for a single NUL byte after the host argument before terminating the argument parsing. Signed-off-by: Brandon Williams <bmw...@google.com> --- daemon.c | 68 ++

[PATCH v3 03/10] protocol: introduce protocol extention mechanisms

2017-10-03 Thread Brandon Williams
. Unknown keys and values must be tolerated. This mechanism is used to communicate which version of the wire protocol a client would like to use with a server. Signed-off-by: Brandon Williams <bmw...@google.com> --- Documentation/config.txt | 17 +++ Documentation/git.txt| 6 Ma

[PATCH v3 00/10] protocol transition

2017-10-03 Thread Brandon Williams
must be ignored. * added API comments for functions in protocol.h * updated various tests in t5700 based on reviewer feedback Brandon Williams (9): pkt-line: add packet_write function protocol: introduce protocol extention mechanisms daemon: recognize hidden request arguments upload-pack

Re: [PATCH 0/3] Comment fixes

2017-10-02 Thread Brandon Williams
| 3 +- > string-list.h | 192 + > 4 files changed, 168 insertions(+), 240 deletions(-) > delete mode 100644 Documentation/technical/api-string-list.txt > > -- > 2.14.1.821.g8fa685d3b7-goog -- Brandon Williams

Re: [PATCH v2] oidmap: map with OID as key

2017-10-02 Thread Brandon Williams
ash(oid->hash)); > oidcpy(>oid, oid); > > - hashmap_add(>map, entry); > + oidmap_put(>map, entry); > return 0; > } > > void oidset_clear(struct oidset *set) > { > - hashmap_free(>map, 1); > + oidmap_free(>map, 1); > } > diff --git a/oidset.h b/oidset.h > index b7eaab5b8..f4c9e0f9c 100644 > --- a/oidset.h > +++ b/oidset.h > @@ -1,6 +1,8 @@ > #ifndef OIDSET_H > #define OIDSET_H > > +#include "oidmap.h" > + > /** > * This API is similar to sha1-array, in that it maintains a set of object > ids > * in a memory-efficient way. The major differences are: > @@ -17,10 +19,10 @@ > * A single oidset; should be zero-initialized (or use OIDSET_INIT). > */ > struct oidset { > - struct hashmap map; > + struct oidmap map; > }; > > -#define OIDSET_INIT { { NULL } } > +#define OIDSET_INIT { OIDMAP_INIT } > > /** > * Returns true iff `set` contains `oid`. > -- > 2.14.2.822.g60be5d43e6-goog > -- Brandon Williams

Re: [PATCH 00/24] object_id part 10

2017-10-02 Thread Brandon Williams
the patches, > and allowed a few others to be dropped during the rebase. Aside from a few unimportant style nits the series looks good to me! -- Brandon Williams

Re: [PATCH 15/24] refs: convert read_ref_at to struct object_id

2017-10-02 Thread Brandon Williams
t; - _time, _tz, _cnt)) { > + if (read_ref_at(real_ref, flags, at_time, nth, oid, NULL, > _time, _tz, _cnt)) { > if (!len) { > if (starts_with(real_ref, "refs/heads/")) { > str = real_ref + 11; This one too. -- Brandon Williams

Re: [PATCH 04/24] refs: convert update_ref and refs_update_ref to use struct object_id

2017-10-02 Thread Brandon Williams
> + if (update_ref(msg, head_ref.buf, , , > REF_NODEREF, UPDATE_REFS_MSG_ON_ERR)) { > res = error(_("could not update %s"), > head_ref.buf); > goto cleanup_head_ref; > diff --git a/t/helper/test-ref-store.c b/t/helper/test-ref-store.c > index 4624238641..af8dba9560 100644 > --- a/t/helper/test-ref-store.c > +++ b/t/helper/test-ref-store.c > @@ -233,15 +233,15 @@ static int cmd_update_ref(struct ref_store *refs, const > char **argv) > const char *new_sha1_buf = notnull(*argv++, "old-sha1"); > const char *old_sha1_buf = notnull(*argv++, "old-sha1"); > unsigned int flags = arg_flags(*argv++, "flags"); > - unsigned char old_sha1[20]; > - unsigned char new_sha1[20]; > + struct object_id old_oid; > + struct object_id new_oid; > > - if (get_sha1_hex(old_sha1_buf, old_sha1) || > - get_sha1_hex(new_sha1_buf, new_sha1)) > + if (get_oid_hex(old_sha1_buf, _oid) || > + get_oid_hex(new_sha1_buf, _oid)) > die("not sha-1"); > > return refs_update_ref(refs, msg, refname, > -new_sha1, old_sha1, > +_oid, _oid, > flags, UPDATE_REFS_DIE_ON_ERR); > } > > diff --git a/transport-helper.c b/transport-helper.c > index c948d5215c..f183601261 100644 > --- a/transport-helper.c > +++ b/transport-helper.c > @@ -795,7 +795,8 @@ static int push_update_refs_status(struct helper_data > *data, > private = apply_refspecs(data->refspecs, data->refspec_nr, > ref->name); > if (!private) > continue; > - update_ref("update by helper", private, ref->new_oid.hash, > NULL, 0, 0); > + update_ref("update by helper", private, >new_oid, NULL, > +0, 0); > free(private); > } > strbuf_release(); > diff --git a/transport.c b/transport.c > index fb8c01e57a..09bd06e6e5 100644 > --- a/transport.c > +++ b/transport.c > @@ -305,8 +305,8 @@ void transport_update_tracking_ref(struct remote *remote, > struct ref *ref, int v > if (ref->deletion) { > delete_ref(NULL, rs.dst, NULL, 0); > } else > - update_ref("update by push", rs.dst, > - ref->new_oid.hash, NULL, 0, 0); > + update_ref("update by push", rs.dst, >new_oid, > +NULL, 0, 0); > free(rs.dst); > } > } > -- > 2.14.2.822.g60be5d43e6 > -- Brandon Williams

Re: [PATCH v3] clang-format: add a comment about the meaning/status of the

2017-10-02 Thread Brandon Williams
it reflects our intentions (of having the code eventually conform to the format rules) and making note that this set of rules still needs to be tuned. Thanks! > > # Use tabs whenever we need to fill whitespace that spans at least from one > tab > # stop to the next one. > -- > 2.14.2-820-gefeff4fbff > -- Brandon Williams

Re: RFC v3: Another proposed hash function transition plan

2017-10-02 Thread Brandon Williams
he community has settled on (https://public-inbox.org/git/xmqqlgkyxgvq@gitster.mtv.corp.google.com/ shows that it should be merged to 'next' soon). Once neat aspect of this transition plan is that it doesn't require a flag day but rather anyone can migrate to the new hash function and still interact with repositories (via the wire) which are still running SHA1. -- Brandon Williams

Re: [PATCH v2 7/9] connect: tell server that the client understands v1

2017-09-29 Thread Brandon Williams
ymmetry I sought is already there. So ignore the above; if > we wanted to make the symmetry more explicit, it would not hurt to > spell the first one as > > grep "clone> .*\\0\\0version=1\\0$" log I think you need three '\' to get an escaped backslash, but I agree, I'll spell this out more explicitly in the tests. > > though. > -- Brandon Williams

Re: [PATCH v2 3/9] protocol: introduce protocol extention mechanisms

2017-09-29 Thread Brandon Williams
_this_, I define the way > in which multiple values to the version variable is parsed like so, > hence this code". IOW, I think this commit should mention how the > "largest one wins" rule would be useful to the clients and the > servers when they want to achieve X---and that X is left unexplained. I believe I mentioned this elsewhere but I think that at some point this logic will probably have to be tweaked again at some point so that a server may be able to prefer one version to another. That being said I can definitely add a comment indicating how this code selects the version and that it can be used to ensure that the latest and greatest protocol version is used. -- Brandon Williams

Re: [PATCH] clang-format: adjust line break penalties

2017-09-29 Thread Brandon Williams
t. I also took a look at the patch and agree with all your points. I'm sure we'll still have to do some tweaking of these parameters but I'll start using this locally and see if I find any problems. -- Brandon Williams

Re: [PATCH v2 7/9] connect: tell server that the client understands v1

2017-09-28 Thread Brandon Williams
On 09/27, Junio C Hamano wrote: > Brandon Williams <bmw...@google.com> writes: > > > Teach the connection logic to tell a serve that it understands protocol > > v1. This is done in 2 different ways for the built in protocols. > > > > 1. git:// > >

Re: [PATCH v2 6/9] connect: teach client to recognize v1 server response

2017-09-28 Thread Brandon Williams
On 09/27, Junio C Hamano wrote: > Brandon Williams <bmw...@google.com> writes: > > > +/* Returns 1 if packet_buffer is a protocol version pkt-line, 0 otherwise. > > */ > > +static int process_protocol_version(void) > > +{ > > + switch (deter

Re: [PATCH v2 3/9] protocol: introduce protocol extention mechanisms

2017-09-28 Thread Brandon Williams
On 09/27, Junio C Hamano wrote: > Brandon Williams <bmw...@google.com> writes: > > > +`GIT_PROTOCOL`:: > > + For internal use only. Used in handshaking the wire protocol. > > + Contains a colon ':' separated list of keys with optional values > > + 'key

Re: [PATCH v2 3/9] protocol: introduce protocol extention mechanisms

2017-09-28 Thread Brandon Williams
response); > > It would be cool to have some documentation here. Thanks for reminding me, I'll get to writing some more documentation :) -- Brandon Williams

Re: [RFC] clang-format: outline the git project's coding style

2017-09-28 Thread Brandon Williams
On 09/28, Johannes Schindelin wrote: > Hi all, > > On Thu, 10 Aug 2017, Johannes Schindelin wrote: > > > On Tue, 8 Aug 2017, Brandon Williams wrote: > > > > > On 08/08, Stefan Beller wrote: > > > > On Tue, Aug 8, 2017 at 5:05 AM, Johannes Schindel

Re: [PATCH v2 4/9] daemon: recognize hidden request arguments

2017-09-28 Thread Brandon Williams
On 09/27, Brandon Williams wrote: > On 09/27, Junio C Hamano wrote: > > Brandon Williams <bmw...@google.com> writes: > > > > > A normal request to git-daemon is structured as > > > "command path/to/repo\0host=..\0" and due to a bug in an old versio

Re: [PATCH] oidmap: map with OID as key

2017-09-27 Thread Brandon Williams
'void *' as the value. -- Brandon Williams

Re: [PATCH v2 8/9] http: tell server that the client understands v1

2017-09-27 Thread Brandon Williams
On 09/27, Junio C Hamano wrote: > Brandon Williams <bmw...@google.com> writes: > > > @@ -897,6 +898,21 @@ static void set_from_env(const char **var, const char > > *envname) > > *var = val; > > } > >

Re: [PATCH v2 5/9] upload-pack, receive-pack: introduce protocol version 1

2017-09-27 Thread Brandon Williams
On 09/27, Junio C Hamano wrote: > Brandon Williams <bmw...@google.com> writes: > > > @@ -1963,6 +1964,19 @@ int cmd_receive_pack(int argc, const char **argv, > > const char *prefix) > > else if (0 <= receive_unpack_limit) > >

Re: [PATCH v2 4/9] daemon: recognize hidden request arguments

2017-09-27 Thread Brandon Williams
On 09/27, Junio C Hamano wrote: > Brandon Williams <bmw...@google.com> writes: > > > A normal request to git-daemon is structured as > > "command path/to/repo\0host=..\0" and due to a bug in an old version of > > git-daemon 73bb33a94 (daemon: Strictly parse

Re: [PATCH v2 6/9] connect: teach client to recognize v1 server response

2017-09-27 Thread Brandon Williams
On 09/27, Junio C Hamano wrote: > Brandon Williams <bmw...@google.com> writes: > > > +/* Returns 1 if packet_buffer is a protocol version pkt-line, 0 otherwise. > > */ > > +static int process_protocol_version(void) > > +{ > > + switch (deter

[PATCH v2 0/9] protocol transition

2017-09-26 Thread Brandon Williams
that user's shouldn't rely on its semantics to hold until it has been thoroughly tested. Brandon Williams (8): pkt-line: add packet_write function protocol: introduce protocol extention mechanisms daemon: recognize hidden request arguments upload-pack, receive-pack: introduce protocol version

[PATCH v2 5/9] upload-pack, receive-pack: introduce protocol version 1

2017-09-26 Thread Brandon Williams
version being spoken. Signed-off-by: Brandon Williams <bmw...@google.com> --- builtin/receive-pack.c | 14 ++ upload-pack.c | 17 - 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index dd0

[PATCH v2 8/9] http: tell server that the client understands v1

2017-09-26 Thread Brandon Williams
Tell a server that protocol v1 can be used by sending the http header 'Git-Protocol' indicating this. Also teach the apache http server to pass through the 'Git-Protocol' header as an environment variable 'GIT_PROTOCOL'. Signed-off-by: Brandon Williams <bmw...@google.com> --- c

[PATCH v2 3/9] protocol: introduce protocol extention mechanisms

2017-09-26 Thread Brandon Williams
. Unknown keys and values must be tolerated. This mechanism is used to communicate which version of the wire protocol a client would like to use with a server. Signed-off-by: Brandon Williams <bmw...@google.com> --- Documentation/config.txt | 17 Documentation/git.txt

[PATCH v2 2/9] pkt-line: add packet_write function

2017-09-26 Thread Brandon Williams
Add a function which can be used to write the contents of an arbitrary buffer. This makes it easy to build up data in a buffer before writing the packet instead of formatting the entire contents of the packet using 'packet_write_fmt()'. Signed-off-by: Brandon Williams <bmw...@google.

[PATCH v2 1/9] connect: in ref advertisement, shallows are last

2017-09-26 Thread Brandon Williams
inting a warning message when encountering capabilities on other lines. Signed-off-by: Jonathan Tan <jonathanta...@google.com> Signed-off-by: Brandon Williams <bmw...@google.com> --- connect.c | 189 -- 1 file changed, 123 insertion

[PATCH v2 7/9] connect: tell server that the client understands v1

2017-09-26 Thread Brandon Williams
having the server whitelist this envvar. Signed-off-by: Brandon Williams <bmw...@google.com> --- connect.c | 37 ++-- t/t5700-protocol-v1.sh | 223 + 2 files changed, 255 insertions(+), 5 deletions(-) create mode 10075

[PATCH v2 9/9] i5700: add interop test for protocol transition

2017-09-26 Thread Brandon Williams
Signed-off-by: Brandon Williams <bmw...@google.com> --- t/interop/i5700-protocol-transition.sh | 68 ++ 1 file changed, 68 insertions(+) create mode 100755 t/interop/i5700-protocol-transition.sh diff --git a/t/interop/i5700-protocol-transition.sh b/t/i

[PATCH v2 4/9] daemon: recognize hidden request arguments

2017-09-26 Thread Brandon Williams
rguments and set 'GIT_PROTOCOL' accordingly. Signed-off-by: Brandon Williams <bmw...@google.com> --- daemon.c | 68 +++- 1 file changed, 59 insertions(+), 9 deletions(-) diff --git a/daemon.c b/daemon.c index 30747075f..36cc794c9

[PATCH v2 6/9] connect: teach client to recognize v1 server response

2017-09-26 Thread Brandon Williams
Teach a client to recognize that a server understands protocol v1 by looking at the first pkt-line the server sends in response. This is done by looking for the response "version 1" send by upload-pack or receive-pack. Signed-off-by: Brandon Williams <bmw...@google.com> ---

Re: [PATCH v5] connect: in ref advertisement, shallows are last

2017-09-26 Thread Brandon Williams
state = EXPECTING_REF; > + /* fallthrough */ > + case EXPECTING_REF: > + if (process_ref(len, , flags, extra_have)) > + break; > + state = EXPECTING_SHALLOW; > + /* fallthrough */ > + case EXPECTING_SHALLOW: > + if (process_shallow(len, shallow_points)) > + break; > + die("protocol error: unexpected '%s'", packet_buffer); > + default: > + die("unexpected state %d", state); > } > - > - if (!check_ref(name, flags)) > - continue; > - > - if (got_dummy_ref_with_capabilities_declaration) > - die("protocol error: unexpected ref after > capabilities^{}"); > - > - ref = alloc_ref(buffer + GIT_SHA1_HEXSZ + 1); > - oidcpy(>old_oid, _oid); > - *list = ref; > - list = >next; > } > > annotate_refs_with_symref_info(*orig_list); > -- > 2.14.1.821.g8fa685d3b7-goog > -- Brandon Williams

Re: [PATCH] Documentation: consolidate submodule..update

2017-09-25 Thread Brandon Williams
be tweaked a bit to say that the '!command' form is ignored by submodule init, in that it isn't copied over from the .gitmodules file, but if it is configured in your config it will be respected by 'submodule update'. > > submodule..branch:: > A remote branch name for tracking updates in the upstream submodule. > -- > 2.14.0.rc0.3.g6c2e499285 > -- Brandon Williams

Re: [PATCH 4/4] Move documentation of string_list into string-list.h

2017-09-25 Thread Brandon Williams
gt; * list->strdup_strings is set, this function can be used to hand > * ownership of a malloc()ed string to list without making an extra > @@ -102,16 +215,34 @@ struct string_list_item *string_list_append(struct > string_list *list, const char > */ > struct string_list_it

Re: [PATCH 3/4] Document submodule_to_gitdir

2017-09-25 Thread Brandon Williams
> int submodule_to_gitdir(struct strbuf *buf, const char *submodule) > { > const struct submodule *sub; > -- > 2.14.1.821.g8fa685d3b7-goog > -- Brandon Williams

Re: [PATCH 2/4] Clarify return value ownership of real_path and read_gitfile_gently

2017-09-25 Thread Brandon Williams
found. > + * return path to git directory if found. The return value comes from > + * a shared pool and should not be freed. > * > * On failure, if return_error_code is not NULL, return_error_code > * will be set to an error code and NULL will be returned. If > -- > 2.14.1.821.g8fa685d3b7-goog > -- Brandon Williams

Re: [PATCH v4] connect: in ref advertisement, shallows are last

2017-09-22 Thread Brandon Williams
} > + state = EXPECTING_REF; > + /* fallthrough */ > + case EXPECTING_REF: > + if (process_ref(, flags, extra_have)) > + break; > + state = EXPECTING_SHALLOW; > + /* fallthrough */ > + case EXPECTING_SHALLOW: > + if (process_shallow(shallow_points)) > + break; > + die("protocol error: unexpected '%s'", packet_buffer); > + default: > + die("unexpected state %d", state); Looks much cleaner, thanks! > } > - > - if (!check_ref(name, flags)) > - continue; > - > - if (got_dummy_ref_with_capabilities_declaration) > - die("protocol error: unexpected ref after > capabilities^{}"); > - > - ref = alloc_ref(buffer + GIT_SHA1_HEXSZ + 1); > - oidcpy(>old_oid, _oid); > - *list = ref; > - list = >next; > } > > annotate_refs_with_symref_info(*orig_list); > -- > 2.14.1.728.g20a5b67d5.dirty > -- Brandon Williams

Re: [PATCH 02/13] oidset2: create oidset subclass with object length and pathname

2017-09-22 Thread Brandon Williams
which we can use to provide a mapping between oids and some arbitrary data. -- Brandon Williams

Re: [PATCH v3] connect: in ref advertisement, shallows are last

2017-09-22 Thread Brandon Williams
he first call to process_dummy_ref() we'd be in the > "expecting ref (or other)" state---and the state transition can > happen in this caller, not in process_dummy_ref() or process_ref(). > > Inside process_dummy_ref() and process_ref(), there would be a call > to the same helper that notices and extracts the server capability > and stores it (or barfs against the second line that advertises the > capability, by noticing that server_capabilities is not NULL). > > Wouldn't that make the presentation of the state machine cleaner? I mentioned this when looking at v2 of this patch, that it would probably be cleaner to remove passing the state variable around the place and updating it inside a helper function. It would just make the logic simpler to follow if 'state' is updated directly instead of indirectly. -- Brandon Williams

Re: [PATCH 4/3] branch: fix "copy" to never touch HEAD

2017-09-22 Thread Brandon Williams
+ test $(git rev-parse --abbrev-ref HEAD) = c1 > ' > > -test_expect_success 'git branch -C c1 c2 should add entries to > .git/logs/HEAD' ' > +test_expect_success 'git branch -C c1 c2 should never touch HEAD' ' > msg="Branch: copied refs/heads/c1 to refs/heads/c2" && > - grep "$msg$" .git/logs/HEAD > + ! grep "$msg$" .git/logs/HEAD > ' > > test_expect_success 'git branch -C master should work when master is checked > out' ' > -- > 2.14.1-929-g25eae544e9 > The rest of the patch lgtm. I agree that this is probably a better UI than without this patch. Especially since the vanilla behavior of git branch is to create a new branch without moving you to that new branch. -- Brandon Williams

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