[PATCH] fetch-pack: grow stateless RPC windows exponentially

2016-07-18 Thread Jonathan Tan
during stateless RPCs to avoid the issue raised and fixed in commit 44d8dc54e73e8010c4bdf57a422fc8d5ce709029. Signed-off-by: Jonathan Tan --- fetch-pack.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fetch-pack.c b/fetch-pack.c index b501d5c..3fcbda2 100644 --- a/fetch-pack.c +++ b/fetch

Re: [PATCH] fetch-pack: grow stateless RPC windows exponentially

2016-07-18 Thread Jonathan Tan
On Mon, Jul 18, 2016 at 12:10 PM, Junio C Hamano wrote: > I'd understand if it were more like "aggressive exponential -> > conservative exponential" without linear phase when stateless_rpc is > in use, though. I just do not quite understand the justification > behind the order of three phases int

Re: [PATCH] fetch-pack: grow stateless RPC windows exponentially

2016-07-18 Thread Jonathan Tan
On Mon, Jul 18, 2016 at 1:00 PM, Junio C Hamano wrote: > Jonathan Nieder writes: > >> You have full control of the growth function. So how about aggressive >> growth until 1024*10? >> >> That is: >> >> Current git: >> n < 1024: aggressive exponential >> 16, 32, 64, 128, 256, 512, 1024 >>

[PATCH v2] fetch-pack: grow stateless RPC windows exponentially

2016-07-18 Thread Jonathan Tan
is no regression in window size). This optimization is only applied during stateless RPCs to avoid the issue raised and fixed in commit 44d8dc54e73e8010c4bdf57a422fc8d5ce709029. Signed-off-by: Jonathan Tan --- fetch-pack.c | 19 --- 1 file changed, 12 insertions(+), 7 deletions

Re: [PATCH v2] fetch-pack: grow stateless RPC windows exponentially

2016-07-19 Thread Jonathan Tan
On Tue, Jul 19, 2016 at 9:46 AM, Stefan Beller wrote: > Care to elaborate on why you choose 11/10 as growth factor? > > (As someone who has a tick in micro optimizing: > 9/8 is roughly the same exponent, but the division > by 8 is easier as it is just a shift by 3. Similar 17/16) I don't have a s

Re: [PATCH] mailinfo.c: move side-effects outside of assert

2016-12-19 Thread Jonathan Tan
On 12/19/2016 12:38 PM, Kyle J. McKay wrote: On Dec 19, 2016, at 12:03, Jeff King wrote: On Sat, Dec 17, 2016 at 11:54:18AM -0800, Kyle J. McKay wrote: Since 6b4b013f18 (mailinfo: handle in-body header continuations, 2016-09-20, v2.11.0) mailinfo.c has contained new code with an assert of the

Re: [PATCH 1/2] mailinfo: Add support for keep_cr

2017-01-12 Thread Jonathan Tan
On 01/12/2017 01:20 AM, Matthew Wilcox wrote: From: Matthew Wilcox If you have a base-64 encoded patch with CRLF endings (as produced by forwarding a patch from Outlook to a Linux machine, for example), the keep_cr setting is not honoured because keep_cr is only passed to mailsplit, which does

Re: [PATCH 2/2] mailinfo: Understand forwarded patches

2017-01-12 Thread Jonathan Tan
On 01/12/2017 01:20 AM, Matthew Wilcox wrote: From: Matthew Wilcox Extend the --scissors mechanism to strip off the preamble created by forwarding a patch. There are a couple of extra headers ("Sent" and "To") added by forwarding, but other than that, the --scissors option will now remove patc

[RFC 01/14] upload-pack: move parsing of "want" line

2017-01-25 Thread Jonathan Tan
Refactor to parse "want" lines when the prefix is found. This makes it easier to add support for another prefix, which will be done in a subsequent commit. Signed-off-by: Jonathan Tan --- upload-pack.c | 28 ++-- 1 file changed, 14 insertions(+), 14 deletion

[RFC 02/14] upload-pack: allow ref name and glob requests

2017-01-25 Thread Jonathan Tan
quot;, among others, and ensure that at least one such ref has been fetched. [1] pack-protocol.txt Signed-off-by: Jonathan Tan --- Documentation/technical/http-protocol.txt | 20 +- Documentation/technical/pack-protocol.txt | 24 +- Documentation/technical/protocol-c

[RFC 13/14] fetch: send want-ref and receive fetched refs

2017-01-25 Thread Jonathan Tan
Teach fetch to send refspecs to the underlying transport, and teach all components used by the HTTP transport (remote-curl, transport-helper, fetch-pack) to understand and propagate the names and SHA-1s of the refs fetched. Signed-off-by: Jonathan Tan --- builtin/clone.c

[RFC 00/14] Allow fetch-pack to send ref names (globs allowed)

2017-01-25 Thread Jonathan Tan
"want-ref refs/heads/foo", "want-ref refs/tags/foo", among others, and ensure that at least one such ref has been fetched. [2] <20161024132932.i42rqn2vlpocq...@sigill.intra.peff.net> Jonathan Tan (14): upload-pack: move parsing of "want" line upl

[RFC 04/14] fetch: refactor the population of hashes

2017-01-25 Thread Jonathan Tan
Populate SHA-1 ref hashes in get_ref_map instead of do_fetch. Besides tightening scopes of variables in the code, this also prepares for a future patch where get_ref_map is called multiple times within do_fetch. Signed-off-by: Jonathan Tan --- builtin/fetch.c | 37

[RFC 05/14] fetch: refactor fetch_refs into two functions

2017-01-25 Thread Jonathan Tan
Refactor the fetch_refs function into a function that does the fetching of refs and another function that stores them. This prepares for a future patch where some processing may be done between those tasks. Signed-off-by: Jonathan Tan --- builtin/fetch.c | 19 +-- 1 file changed

[RFC 12/14] fetch-pack: do not printf after closing stdout

2017-01-25 Thread Jonathan Tan
In fetch-pack, during a stateless RPC, printf is invoked after stdout is closed. Update the code to not do this, preserving the existing behavior. Signed-off-by: Jonathan Tan --- builtin/fetch-pack.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/builtin

[RFC 03/14] upload-pack: test negotiation with changing repo

2017-01-25 Thread Jonathan Tan
his effort, a mechanism to substitute strings in an HTTP response only on the first invocation is added. Signed-off-by: Jonathan Tan --- t/lib-httpd.sh | 1 + t/lib-httpd/apache.conf| 8 t/lib-httpd/one-time-sed.sh| 8 t/t5552-upload-pack-ref-

[RFC 14/14] DONT USE advertise_ref_in_want=1

2017-01-25 Thread Jonathan Tan
--- t/t5500-fetch-pack.sh | 2 ++ upload-pack.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh index 18fe23c97..f39dbcab8 100755 --- a/t/t5500-fetch-pack.sh +++ b/t/t5500-fetch-pack.sh @@ -551,6 +551,7 @@ test_expect_succ

[RFC 07/14] fetch-pack: put shallow info in out param

2017-01-25 Thread Jonathan Tan
remote-tracking branch seems to track more than one remote branch. This is the 1st of 3 patches to eliminate using input refs to communicate information obtained by the fetch mechanism. Signed-off-by: Jonathan Tan --- builtin/clone.c| 4 ++-- builtin/fetch.c| 23

[RFC 11/14] fetch-pack: support want-ref

2017-01-25 Thread Jonathan Tan
Teach fetch-pack to use the want-ref mechanism whenever the server advertises it. Signed-off-by: Jonathan Tan --- builtin/fetch-pack.c | 5 +- fetch-pack.c | 173 -- fetch-pack.h | 2 + t/t5500-fetch-pack.sh | 42

[RFC 10/14] fetch-pack: support partial names and globs

2017-01-25 Thread Jonathan Tan
Teach fetch-pack to support partial ref names and ref patterns as input. This does not use "want-ref" yet - support for that will be added in a future patch. Signed-off-by: Jonathan Tan --- builtin/fetch-pack.c | 40 - remote.c

[RFC 08/14] fetch-pack: check returned refs for matches

2017-01-25 Thread Jonathan Tan
the nested for loop in this patch.) Signed-off-by: Jonathan Tan --- builtin/fetch-pack.c | 7 ++- fetch-pack.c | 9 ++--- fetch-pack.h | 2 -- remote.h | 3 +-- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/builtin/fetch-pack.c b/builti

[RFC 09/14] transport: put ref oid in out param

2017-01-25 Thread Jonathan Tan
the fetch mechanism. Signed-off-by: Jonathan Tan --- builtin/clone.c | 14 -- builtin/fetch-pack.c | 4 ++-- fetch-pack.c | 26 +++--- fetch-pack.h | 2 +- transport-helper.c | 34 +++--- transport.c

[RFC 06/14] fetch: refactor to make function args narrower

2017-01-25 Thread Jonathan Tan
Refactor find_non_local_tags and get_ref_map to only take the information they need instead of the entire transport struct. Besides improving code clarity, this also improves their flexibility, which will be needed in a future patch. Signed-off-by: Jonathan Tan --- builtin/fetch.c | 23

Re: [RFC 12/14] fetch-pack: do not printf after closing stdout

2017-01-26 Thread Jonathan Tan
On 01/25/2017 04:50 PM, Stefan Beller wrote: On Wed, Jan 25, 2017 at 2:03 PM, Jonathan Tan wrote: In fetch-pack, during a stateless RPC, printf is invoked after stdout is closed. Update the code to not do this, preserving the existing behavior. This seems to me as if it could go as an

Re: [RFC 00/14] Allow fetch-pack to send ref names (globs allowed)

2017-01-26 Thread Jonathan Tan
Thanks for your comments. On 01/26/2017 03:00 PM, Jeff King wrote: On Wed, Jan 25, 2017 at 02:02:53PM -0800, Jonathan Tan wrote: Negotiation currently happens by upload-pack initially sending a list of refs with names and SHA-1 hashes, and then several request/response pairs in which the

Re: [RFC 02/14] upload-pack: allow ref name and glob requests

2017-01-26 Thread Jonathan Tan
On 01/26/2017 02:23 PM, Junio C Hamano wrote: Jonathan Tan writes: Currently, while performing packfile negotiation [1], upload-pack allows clients to specify their desired objects only as SHA-1s. This causes: (a) vulnerability to failure when an object turns non-existent during

Re: [RFC 03/14] upload-pack: test negotiation with changing repo

2017-01-26 Thread Jonathan Tan
On 01/26/2017 02:33 PM, Junio C Hamano wrote: Jonathan Tan writes: diff --git a/t/lib-httpd/one-time-sed.sh b/t/lib-httpd/one-time-sed.sh new file mode 100644 index 0..060ec0300 --- /dev/null +++ b/t/lib-httpd/one-time-sed.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +if [ -e one-time-sed ]; then

Re: Deadlock between git-remote-http and git fetch-pack

2017-01-27 Thread Jonathan Tan
On 01/27/2017 02:31 PM, tsuna wrote: Hi there, While investigating a hung job in our CI system today, I think I found a deadlock in git-remote-http Git version: 2.9.3 Linux (amd64) kernel 4.9.0 Excerpt from the process list: jenkins 27316 0.0 0.0 18508 6024 ?S19:30 0:00 |

Re: [RFC 00/14] Allow fetch-pack to send ref names (globs allowed)

2017-02-07 Thread Jonathan Tan
Looking back at the comments I have received in reply, I think that there were two major concerns: (i) the case where a server ACKs a client "have" line and the client forever thinks that the server has it, but it may not be the case for future servers (or future invocations of the same server), an

[PATCH for NEXT] grep: do not unnecessarily query repo for "--"

2017-02-13 Thread Jonathan Tan
ore, always interpret "--" as signaling the end of options, instead of trying to interpret it as a rev first. Signed-off-by: Jonathan Tan --- There is probably a similar bug for commands of the form: git grep --no-index pattern foo If there is a repo and "foo" is a rev, th

Re: [PATCH 6/7] grep: avoid resolving revision names in --no-index case

2017-02-14 Thread Jonathan Tan
On 02/13/2017 10:07 PM, Jeff King wrote: diff --git a/builtin/grep.c b/builtin/grep.c index e83b33bda..c4c632594 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -1176,6 +1176,12 @@ int cmd_grep(int argc, const char **argv, const char *prefix) break; }

Re: [PATCH 0/7] grep rev/path parsing fixes

2017-02-14 Thread Jonathan Tan
On 02/13/2017 10:00 PM, Jeff King wrote: I've fixed that, along with a few other bugs and cleanups. The complete series is below. Patch 2 is your (untouched) patch. My suggestions for your test are in patch 3, which can either remain on its own or be squashed in. [1/7]: grep: move thread initi

Re: [PATCH 6/7] grep: avoid resolving revision names in --no-index case

2017-02-14 Thread Jonathan Tan
On 02/14/2017 10:04 AM, Jeff King wrote: On Tue, Feb 14, 2017 at 08:53:04AM -0800, Jonathan Tan wrote: On 02/13/2017 10:07 PM, Jeff King wrote: diff --git a/builtin/grep.c b/builtin/grep.c index e83b33bda..c4c632594 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -1176,6 +1176,12 @@ int

Re: [BUG] submodule config does not apply to upper case submodules?

2017-02-15 Thread Jonathan Tan
On 02/15/2017 10:53 AM, Junio C Hamano wrote: Lars Schneider writes: It looks like as if submodule configs ("submodule.*") for submodules with upper case names are ignored. This observation is surprising, as the second level in three-level names like ".." is designed to be case sensitive. A

Re: [BUG] submodule config does not apply to upper case submodules?

2017-02-15 Thread Jonathan Tan
On 02/15/2017 03:11 PM, Junio C Hamano wrote: Junio C Hamano writes: Perhaps something like this? This looks good. I was hoping to unify the processing logic between this CLI parsing and the usual stream parsing, but this approach is probably simpler. config.c | 16 +++- 1 f

Re: [PATCH 1/3] add git_psprintf helper function

2017-02-16 Thread Jonathan Tan
On 02/16/2017 03:28 AM, Maxim Moseychuk wrote: There are a number of places in the code where we call xsnprintf(), with the assumption that the output will fit into the buffer. If the buffer is small, then git die. In many places buffers have compile-time size, but generated string depends from c

Re: [RFC/PATCH 0/2] place cherry pick line below commit title

2016-10-05 Thread Jonathan Tan
On 10/04/2016 10:25 AM, Junio C Hamano wrote: So I would say it is perfectly OK if your update works only for cases we can clearly define the semantics for. For example, we can even start with something simple like: * A RFC822-header like line, together with any number of whitespace indente

Re: [RFC/PATCH 0/2] place cherry pick line below commit title

2016-10-05 Thread Jonathan Tan
On 10/04/2016 11:28 AM, Junio C Hamano wrote: An addendum. We may also want to be prepared to accept an input that has some garbage lines _after_ the trailer block, if we can clearly identify them as such. For example, we could change the definition of "the last paragraph" as "the block of line

[PATCH 0/5] allow non-trailers and multiple-line trailers

2016-10-11 Thread Jonathan Tan
n, before continuing with my work on top of this patch set. Support for steps 2 and 3, including my original use case of being looser in the definition of a trailer when invoking "cherry-pick -x" (and thus suppressing the insertion of a newline) will come in a subsequent patch set. [1

[PATCH 5/5] trailer: support values folded to multiple lines

2016-10-11 Thread Jonathan Tan
Currently, interpret-trailers requires that a trailer be only on 1 line. For example: a: first line second line would be interpreted as one trailer line followed by one non-trailer line. Make interpret-trailers support RFC 822-style folding, treating those lines as one logical trailer. --

[PATCH 1/5] trailer: use singly-linked list, not doubly

2016-10-11 Thread Jonathan Tan
Use singly-linked lists (instead of doubly-linked lists) in trailer to keep track of arguments (whether implicit from configuration or explicit from the command line) and trailer items. This change significantly reduces the code length and simplifies the code. There are now fewer pointers to be ma

[PATCH 2/5] trailer: streamline trailer item create and add

2016-10-11 Thread Jonathan Tan
Currently, creation and addition (to a list) of trailer items are spread across multiple functions. Streamline this by only having 2 functions: one to parse the user-supplied string, and one to add the parsed information to a list. --- trailer.c | 135 +-

[PATCH 4/5] trailer: allow non-trailers in trailer block

2016-10-11 Thread Jonathan Tan
Currently, interpret-trailers requires all lines of a trailer block to be trailers (or comments) - if not it would not identify that block as a trailer block, and thus create its own trailer block, inserting a blank line. For example: echo -e "\na: b\nnot trailer" | git interpret-trailers --t

[PATCH 3/5] trailer: make args have their own struct

2016-10-11 Thread Jonathan Tan
Improve type safety by making arguments (whether from configuration or from the command line) have their own "struct arg_item" type, separate from the "struct trailer_item" type used to represent the trailers in the buffer being manipulated. Also take the opportunity to refine the "struct trailer_

[PATCH v2 3/6] trailer: streamline trailer item create and add

2016-10-12 Thread Jonathan Tan
Currently, creation and addition (to a list) of trailer items are spread across multiple functions. Streamline this by only having 2 functions: one to parse the user-supplied string, and one to add the parsed information to a list. --- trailer.c | 130 +-

[PATCH v2 6/6] trailer: support values folded to multiple lines

2016-10-12 Thread Jonathan Tan
Currently, interpret-trailers requires that a trailer be only on 1 line. For example: a: first line second line would be interpreted as one trailer line followed by one non-trailer line. Make interpret-trailers support RFC 822-style folding, treating those lines as one logical trailer. --

[PATCH v2 1/6] trailer: improve const correctness

2016-10-12 Thread Jonathan Tan
Change "const char *" to "char *" in struct trailer_item and in the return value of apply_command (since those strings are owned strings). Change "struct conf_info *" to "const struct conf_info *" (since that struct is not modified). --- trailer.c | 14 +++--- 1 file changed, 7 insertions

[PATCH v2 0/6] allow non-trailers and multiple-line trailers

2016-10-12 Thread Jonathan Tan
;char *" instead of "struct strbuf" - Modified test slightly to test whitespace at beginning of line Jonathan Tan (6): trailer: improve const correctness trailer: use list.h for doubly-linked list trailer: streamline trailer item create and add trailer: make args have their ow

[PATCH v2 2/6] trailer: use list.h for doubly-linked list

2016-10-12 Thread Jonathan Tan
Replace the existing handwritten implementation of a doubly-linked list in trailer.c with the functions and macros from list.h. This significantly simplifies the code. --- trailer.c | 258 ++ 1 file changed, 91 insertions(+), 167 deletion

[PATCH v2 5/6] trailer: allow non-trailers in trailer block

2016-10-12 Thread Jonathan Tan
Currently, interpret-trailers requires all lines of a trailer block to be trailers (or comments) - if not it would not identify that block as a trailer block, and thus create its own trailer block, inserting a blank line. For example: echo -e "\na: b\nnot trailer" | git interpret-trailers --t

[PATCH v2 4/6] trailer: make args have their own struct

2016-10-12 Thread Jonathan Tan
Improve type safety by making arguments (whether from configuration or from the command line) have their own "struct arg_item" type, separate from the "struct trailer_item" type used to represent the trailers in the buffer being manipulated. This change also prepares "struct trailer_item" to be fu

[PATCH v3 1/6] trailer: improve const correctness

2016-10-14 Thread Jonathan Tan
Change "const char *" to "char *" in struct trailer_item and in the return value of apply_command (since those strings are owned strings). Change "struct conf_info *" to "const struct conf_info *" (since that struct is not modified). Signed-o

[PATCH v3 0/6] allow non-trailers and multiple-line trailers

2016-10-14 Thread Jonathan Tan
Ah, I knew I forgot something. These are exactly the same as v2, except that these are signed off. Jonathan Tan (6): trailer: improve const correctness trailer: use list.h for doubly-linked list trailer: streamline trailer item create and add trailer: make args have their own struct

[PATCH v3 4/6] trailer: make args have their own struct

2016-10-14 Thread Jonathan Tan
truct trailer_item" to be further differentiated from "struct arg_item" in future patches. Signed-off-by: Jonathan Tan --- trailer.c | 135 +++--- 1 file changed, 85 insertions(+), 50 deletions(-) diff --git a/trailer.c b/trail

[PATCH v3 2/6] trailer: use list.h for doubly-linked list

2016-10-14 Thread Jonathan Tan
Replace the existing handwritten implementation of a doubly-linked list in trailer.c with the functions and macros from list.h. This significantly simplifies the code. Signed-off-by: Jonathan Tan --- trailer.c | 258 ++ 1 file changed

[PATCH v3 3/6] trailer: streamline trailer item create and add

2016-10-14 Thread Jonathan Tan
Currently, creation and addition (to a list) of trailer items are spread across multiple functions. Streamline this by only having 2 functions: one to parse the user-supplied string, and one to add the parsed information to a list. Signed-off-by: Jonathan Tan --- trailer.c | 130

[PATCH v3 6/6] trailer: support values folded to multiple lines

2016-10-14 Thread Jonathan Tan
. Signed-off-by: Jonathan Tan --- Documentation/git-interpret-trailers.txt | 7 +- t/t7513-interpret-trailers.sh| 139 +++ trailer.c| 22 +++-- 3 files changed, 160 insertions(+), 8 deletions(-) diff --git a/Documentation

[PATCH v3 5/6] trailer: allow non-trailers in trailer block

2016-10-14 Thread Jonathan Tan
/stable/linux-stable/+/e7d316a02f683864a12389f8808570e37fb90aa3 Signed-off-by: Jonathan Tan --- Documentation/git-interpret-trailers.txt | 3 +- t/t7513-interpret-trailers.sh| 35 +++ trailer.c| 77 ++-- 3 files changed,

Re: [PATCH v3 5/6] trailer: allow non-trailers in trailer block

2016-10-17 Thread Jonathan Tan
On 10/17/2016 06:42 PM, Junio C Hamano wrote: Stefan Beller writes: On Fri, Oct 14, 2016 at 10:38 AM, Jonathan Tan wrote: Existing trailers are extracted from the input message by looking for -a group of one or more lines that contain a colon (by default), where +a group of one or more

Re: [PATCH v3 5/6] trailer: allow non-trailers in trailer block

2016-10-19 Thread Jonathan Tan
On 10/18/2016 09:36 AM, Junio C Hamano wrote: Jonathan Tan writes: * rs/c-auto-resets-attributes: pretty: avoid adding reset for %C(auto) if output is empty And neither of the two colon containing line remotely resembles how a typical RFC-822 header is formatted. So that may serve

[PATCH v4 0/8] allow non-trailers and multiple-line trailers

2016-10-20 Thread Jonathan Tan
to the existing behavior of ignoring comments, since the number of trailers and non-trailers in the trailer block now matters more new->7/8: - new patch 6/6->8/8: - updated trailer block recognizing code, since the continuation lines must not be counted if they follow a

[PATCH v4 1/8] trailer: improve const correctness

2016-10-20 Thread Jonathan Tan
Change "const char *" to "char *" in struct trailer_item and in the return value of apply_command (since those strings are owned strings). Change "struct conf_info *" to "const struct conf_info *" (since that struct is not modified). Signed-o

[PATCH v4 5/8] trailer: clarify failure modes in parse_trailer

2016-10-20 Thread Jonathan Tan
urced from a file or from a command-line argument. Extract a function to find the separator, allowing the invokers of parse_trailer to determine how to handle the failure modes instead of making parse_trailer do it. Signed-off-by: Jonathan Tan --- trailer.c

[PATCH v4 4/8] trailer: make args have their own struct

2016-10-20 Thread Jonathan Tan
truct trailer_item" to be further differentiated from "struct arg_item" in future patches. Signed-off-by: Jonathan Tan --- trailer.c | 135 +++--- 1 file changed, 85 insertions(+), 50 deletions(-) diff --git a/trailer.c b/trail

[PATCH v4 3/8] trailer: streamline trailer item create and add

2016-10-20 Thread Jonathan Tan
Currently, creation and addition (to a list) of trailer items are spread across multiple functions. Streamline this by only having 2 functions: one to parse the user-supplied string, and one to add the parsed information to a list. Signed-off-by: Jonathan Tan --- trailer.c | 130

[PATCH v4 6/8] trailer: allow non-trailers in trailer block

2016-10-20 Thread Jonathan Tan
89f8808570e37fb90aa3 Signed-off-by: Jonathan Tan --- Documentation/git-interpret-trailers.txt | 5 +- t/t7513-interpret-trailers.sh| 115 +++ trailer.c| 89 3 files changed, 194 insertions(+), 1

[PATCH v4 2/8] trailer: use list.h for doubly-linked list

2016-10-20 Thread Jonathan Tan
Replace the existing handwritten implementation of a doubly-linked list in trailer.c with the functions and macros from list.h. This significantly simplifies the code. Signed-off-by: Jonathan Tan Signed-off-by: Ramsay Jones --- trailer.c | 258

[PATCH v4 7/8] trailer: forbid leading whitespace in trailers

2016-10-20 Thread Jonathan Tan
Currently, interpret-trailers allows leading whitespace in trailer lines. This leads to false positives, especially for quoted lines or bullet lists. Forbid leading whitespace in trailers. Signed-off-by: Jonathan Tan --- Documentation/git-interpret-trailers.txt | 2 +- t/t7513-interpret

[PATCH v4 8/8] trailer: support values folded to multiple lines

2016-10-20 Thread Jonathan Tan
. Signed-off-by: Jonathan Tan --- Documentation/git-interpret-trailers.txt | 7 +- t/t7513-interpret-trailers.sh| 169 +++ trailer.c| 43 ++-- 3 files changed, 210 insertions(+), 9 deletions(-) diff --git a/Documentation/git

Re: [PATCH v4 5/8] trailer: clarify failure modes in parse_trailer

2016-10-20 Thread Jonathan Tan
On 10/20/2016 03:14 PM, Junio C Hamano wrote: Stefan Beller writes: +static int find_separator(const char *line) +{ + const char *c; + for (c = line; ; c++) { + if (!*c || *c == '\n') + return -1; + if (*c == '=' || strchr(separator

Re: [PATCH v4 5/8] trailer: clarify failure modes in parse_trailer

2016-10-20 Thread Jonathan Tan
On 10/20/2016 03:40 PM, Jonathan Tan wrote: On 10/20/2016 03:14 PM, Junio C Hamano wrote: Stefan Beller writes: +static int find_separator(const char *line) +{ + const char *c; + for (c = line; ; c++) { + if (!*c || *c == '\n') +

Re: [PATCH v4 5/8] trailer: clarify failure modes in parse_trailer

2016-10-20 Thread Jonathan Tan
On 10/20/2016 03:45 PM, Junio C Hamano wrote: Jonathan Tan writes: If we do that, there is also the necessity of creating a string that combines the separators and '=' (I guess '\n' is not necessary now, since all the lines are null terminated). I'm OK either way. (W

[PATCH v5 1/8] trailer: improve const correctness

2016-10-21 Thread Jonathan Tan
Change "const char *" to "char *" in struct trailer_item and in the return value of apply_command (since those strings are owned strings). Change "struct conf_info *" to "const struct conf_info *" (since that struct is not modified). Signed-o

[PATCH v5 5/8] trailer: clarify failure modes in parse_trailer

2016-10-21 Thread Jonathan Tan
tween command line arguments (which allow '=' as separator) and file input (which does not allow '=' as separator). Signed-off-by: Jonathan Tan --- trailer.c | 75 --- 1 file changed, 53 insertions(+), 22 deletions(-)

[PATCH v5 4/8] trailer: make args have their own struct

2016-10-21 Thread Jonathan Tan
truct trailer_item" to be further differentiated from "struct arg_item" in future patches. Signed-off-by: Jonathan Tan --- trailer.c | 135 +++--- 1 file changed, 85 insertions(+), 50 deletions(-) diff --git a/trailer.c b/trail

[PATCH v5 7/8] trailer: forbid leading whitespace in trailers

2016-10-21 Thread Jonathan Tan
Currently, interpret-trailers allows leading whitespace in trailer lines. This leads to false positives, especially for quoted lines or bullet lists. Forbid leading whitespace in trailers. Signed-off-by: Jonathan Tan --- Documentation/git-interpret-trailers.txt | 2 +- t/t7513-interpret

[PATCH v5 6/8] trailer: allow non-trailers in trailer block

2016-10-21 Thread Jonathan Tan
89f8808570e37fb90aa3 Signed-off-by: Jonathan Tan --- Documentation/git-interpret-trailers.txt | 5 +- t/t7513-interpret-trailers.sh| 115 +++ trailer.c| 89 3 files changed, 194 insertions(+), 1

[PATCH v5 0/8] allow non-trailers and multiple-line trailers

2016-10-21 Thread Jonathan Tan
ine). So I have left it as its own function. No other updates. Jonathan Tan (8): trailer: improve const correctness trailer: use list.h for doubly-linked list trailer: streamline trailer item create and add trailer: make args have their own struct trailer: clarify failure modes in parse_

[PATCH v5 3/8] trailer: streamline trailer item create and add

2016-10-21 Thread Jonathan Tan
Currently, creation and addition (to a list) of trailer items are spread across multiple functions. Streamline this by only having 2 functions: one to parse the user-supplied string, and one to add the parsed information to a list. Signed-off-by: Jonathan Tan --- trailer.c | 130

[PATCH v5 8/8] trailer: support values folded to multiple lines

2016-10-21 Thread Jonathan Tan
. Signed-off-by: Jonathan Tan --- Documentation/git-interpret-trailers.txt | 7 +- t/t7513-interpret-trailers.sh| 169 +++ trailer.c| 45 ++-- 3 files changed, 211 insertions(+), 10 deletions(-) diff --git a/Documentation

[PATCH v5 2/8] trailer: use list.h for doubly-linked list

2016-10-21 Thread Jonathan Tan
Replace the existing handwritten implementation of a doubly-linked list in trailer.c with the functions and macros from list.h. This significantly simplifies the code. Signed-off-by: Jonathan Tan Signed-off-by: Ramsay Jones --- trailer.c | 258

Re: What's cooking in git.git (Oct 2016, #07; Wed, 26)

2016-10-26 Thread Jonathan Tan
On 10/26/2016 03:29 PM, Junio C Hamano wrote: * jt/trailer-with-cruft (2016-10-21) 8 commits - trailer: support values folded to multiple lines - trailer: forbid leading whitespace in trailers - trailer: allow non-trailers in trailer block - trailer: clarify failure modes in parse_trailer -

[PATCH 1/4] commit: make ignore_non_trailer take buf/len

2016-10-28 Thread Jonathan Tan
Make ignore_non_trailer take a buf/len pair instead of struct strbuf. Signed-off-by: Jonathan Tan --- builtin/commit.c | 2 +- commit.c | 22 +++--- commit.h | 2 +- trailer.c| 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a

[PATCH 2/4] trailer: avoid unnecessary splitting on lines

2016-10-28 Thread Jonathan Tan
: Jonathan Tan --- trailer.c | 215 +- 1 file changed, 116 insertions(+), 99 deletions(-) diff --git a/trailer.c b/trailer.c index 6d8375b..d4d9e10 100644 --- a/trailer.c +++ b/trailer.c @@ -102,12 +102,12 @@ static int same_trailer(struct

[PATCH 0/4] Make other git commands use trailer layout

2016-10-28 Thread Jonathan Tan
t, the aforementioned commands would now handle trailers like those described in [1]. [1] <84f28caa-2e4b-1231-1a76-3b7e765c0...@google.com> Jonathan Tan (4): commit: make ignore_non_trailer take buf/len trailer: avoid unnecessary splitting on lines trailer: have function to describe trail

[PATCH 3/4] trailer: have function to describe trailer layout

2016-10-28 Thread Jonathan Tan
, another component will be made to use this. Signed-off-by: Jonathan Tan --- trailer.c | 120 +++--- trailer.h | 25 + 2 files changed, 108 insertions(+), 37 deletions(-) diff --git a/trailer.c b/trailer.c index d4d9e10..2f5c815

[PATCH 4/4] sequencer: use trailer's trailer layout

2016-10-28 Thread Jonathan Tan
ler blocks under certain conditions, and therefore suppressing the extra newline in those cases. Consistency with trailer extends to respecting trailer configs. Tests have been included to show that. Signed-off-by: Jonathan Tan --- sequencer.c | 75 +-

Re: [PATCH 4/4] sequencer: use trailer's trailer layout

2016-11-01 Thread Jonathan Tan
On 10/31/2016 06:11 PM, Junio C Hamano wrote: Jonathan Tan writes: diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh index ba4902d..635b394 100755 --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@ -1277,8 +1277,7 @@ EOF 4:Subject: [PATCH] subject 8: 9:I want to

[PATCH v2 4/5] trailer: have function to describe trailer layout

2016-11-01 Thread Jonathan Tan
, another component will be made to use this. Signed-off-by: Jonathan Tan --- trailer.c | 118 +++--- trailer.h | 25 + 2 files changed, 107 insertions(+), 36 deletions(-) diff --git a/trailer.c b/trailer.c index f5427ec..7265a50

[PATCH v2 5/5] sequencer: use trailer's trailer layout

2016-11-01 Thread Jonathan Tan
ler blocks under certain conditions, and therefore suppressing the extra newline in those cases. Consistency with trailer extends to respecting trailer configs. Tests have been included to show that. Signed-off-by: Jonathan Tan --- sequencer.c | 75 +-

[PATCH v2 2/5] commit: make ignore_non_trailer take buf/len

2016-11-01 Thread Jonathan Tan
Make ignore_non_trailer take a buf/len pair instead of struct strbuf. Signed-off-by: Jonathan Tan --- builtin/commit.c | 2 +- commit.c | 22 +++--- commit.h | 2 +- trailer.c| 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a

[PATCH v2 3/5] trailer: avoid unnecessary splitting on lines

2016-11-01 Thread Jonathan Tan
: Jonathan Tan --- trailer.c | 195 -- 1 file changed, 101 insertions(+), 94 deletions(-) diff --git a/trailer.c b/trailer.c index 04edab2..f5427ec 100644 --- a/trailer.c +++ b/trailer.c @@ -102,12 +102,12 @@ static int same_trailer(struct

[PATCH v2 0/5] Make other git commands use trailer layout

2016-11-01 Thread Jonathan Tan
to create temporary strings that include '\n' to be passed into the find_separator method. In 2/4 (now 3/5), I've also changed some variable names as requested (e.g. sb -> input, and un-did some others). Jonathan Tan (5): trailer: be stricter in parsing separators commit:

[PATCH v2 1/5] trailer: be stricter in parsing separators

2016-11-01 Thread Jonathan Tan
tor-starts-line case because some callers of this function need such a distinction.) Signed-off-by: Jonathan Tan --- trailer.c | 23 +-- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/trailer.c b/trailer.c index f0ecde2..0ee634f 100644 --- a/trailer.c +++ b

Re: [PATCH v2 1/5] trailer: be stricter in parsing separators

2016-11-01 Thread Jonathan Tan
On 11/01/2016 01:37 PM, Junio C Hamano wrote: Junio C Hamano writes: Jonathan Tan writes: Currently, a line is interpreted to be a trailer line if it contains a separator. Make parsing stricter by requiring the text on the left of the separator, if not the empty string, to be of the

[PATCH v3 0/5] Make other git commands use trailer layout

2016-11-02 Thread Jonathan Tan
This is the same as v2 except that in 1/5, the comment about find_separators has been moved from the commit message to the code itself. Also, a trailing whitespace and unused variable fix. Jonathan Tan (5): trailer: be stricter in parsing separators commit: make ignore_non_trailer take buf

[PATCH v3 2/5] commit: make ignore_non_trailer take buf/len

2016-11-02 Thread Jonathan Tan
Make ignore_non_trailer take a buf/len pair instead of struct strbuf. Signed-off-by: Jonathan Tan --- builtin/commit.c | 2 +- commit.c | 22 +++--- commit.h | 2 +- trailer.c| 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a

[PATCH v3 1/5] trailer: be stricter in parsing separators

2016-11-02 Thread Jonathan Tan
Currently, a line is interpreted to be a trailer line if it contains a separator. Make parsing stricter by requiring the text on the left of the separator, if not the empty string, to be of the "" form. Signed-off-by: Jonathan Tan --- trailer.c | 27 +-- 1 fi

[PATCH v3 3/5] trailer: avoid unnecessary splitting on lines

2016-11-02 Thread Jonathan Tan
: Jonathan Tan --- trailer.c | 194 -- 1 file changed, 100 insertions(+), 94 deletions(-) diff --git a/trailer.c b/trailer.c index 9d7765e..afbff4b 100644 --- a/trailer.c +++ b/trailer.c @@ -102,12 +102,12 @@ static int same_trailer(struct

[PATCH v3 5/5] sequencer: use trailer's trailer layout

2016-11-02 Thread Jonathan Tan
ler blocks under certain conditions, and therefore suppressing the extra newline in those cases. Consistency with trailer extends to respecting trailer configs. Tests have been included to show that. Signed-off-by: Jonathan Tan --- sequencer.c | 75 +-

  1   2   3   4   5   6   7   8   9   10   >